{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "基于评分卡的风控模型开发  \n",
    "  \n",
    "数据集GiveMeSomeCredit，15万样本数据  \n",
    "https://www.kaggle.com/c/GiveMeSomeCredit/data \n",
    "使用WOE进行特征变换，IV进行特征筛选，LR构建风控模型，并对模型评分规则进行可解释性说明   \n",
    "- 基本属性：包括了借款人当时的年龄\n",
    "- 偿债能力：包括了借款人的月收入、负债比率\n",
    "- 信用往来：两年内35-59天逾期次数、两年内60-89天逾期次数、两年内90天或高于90天逾期的次数\n",
    "- 财产状况：包括了开放式信贷和贷款数量、不动产贷款或额度数量。\n",
    "- 其他因素：包括了借款人的家属数量"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-12T02:57:06.924126Z",
     "start_time": "2020-12-12T02:57:06.918126Z"
    }
   },
   "source": [
    "## 数据预处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:07.140888Z",
     "start_time": "2021-01-03T03:34:05.281782Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:07.516910Z",
     "start_time": "2021-01-03T03:34:07.144888Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>SeriousDlqin2yrs</th>\n",
       "      <th>RevolvingUtilizationOfUnsecuredLines</th>\n",
       "      <th>age</th>\n",
       "      <th>NumberOfTime30-59DaysPastDueNotWorse</th>\n",
       "      <th>DebtRatio</th>\n",
       "      <th>MonthlyIncome</th>\n",
       "      <th>NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>NumberOfTimes90DaysLate</th>\n",
       "      <th>NumberRealEstateLoansOrLines</th>\n",
       "      <th>NumberOfTime60-89DaysPastDueNotWorse</th>\n",
       "      <th>NumberOfDependents</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0.766127</td>\n",
       "      <td>45</td>\n",
       "      <td>2</td>\n",
       "      <td>0.802982</td>\n",
       "      <td>9120.0</td>\n",
       "      <td>13</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0.957151</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>0.121876</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0.658180</td>\n",
       "      <td>38</td>\n",
       "      <td>1</td>\n",
       "      <td>0.085113</td>\n",
       "      <td>3042.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0.233810</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>0.036050</td>\n",
       "      <td>3300.0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0.907239</td>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "      <td>0.024926</td>\n",
       "      <td>63588.0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>0.213179</td>\n",
       "      <td>74</td>\n",
       "      <td>0</td>\n",
       "      <td>0.375607</td>\n",
       "      <td>3500.0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>0.305682</td>\n",
       "      <td>57</td>\n",
       "      <td>0</td>\n",
       "      <td>5710.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>0.754464</td>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>0.209940</td>\n",
       "      <td>3500.0</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>0.116951</td>\n",
       "      <td>27</td>\n",
       "      <td>0</td>\n",
       "      <td>46.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>0</td>\n",
       "      <td>0.189169</td>\n",
       "      <td>57</td>\n",
       "      <td>0</td>\n",
       "      <td>0.606291</td>\n",
       "      <td>23684.0</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Unnamed: 0  SeriousDlqin2yrs  RevolvingUtilizationOfUnsecuredLines  age  \\\n",
       "0           1                 1                              0.766127   45   \n",
       "1           2                 0                              0.957151   40   \n",
       "2           3                 0                              0.658180   38   \n",
       "3           4                 0                              0.233810   30   \n",
       "4           5                 0                              0.907239   49   \n",
       "5           6                 0                              0.213179   74   \n",
       "6           7                 0                              0.305682   57   \n",
       "7           8                 0                              0.754464   39   \n",
       "8           9                 0                              0.116951   27   \n",
       "9          10                 0                              0.189169   57   \n",
       "\n",
       "   NumberOfTime30-59DaysPastDueNotWorse    DebtRatio  MonthlyIncome  \\\n",
       "0                                     2     0.802982         9120.0   \n",
       "1                                     0     0.121876         2600.0   \n",
       "2                                     1     0.085113         3042.0   \n",
       "3                                     0     0.036050         3300.0   \n",
       "4                                     1     0.024926        63588.0   \n",
       "5                                     0     0.375607         3500.0   \n",
       "6                                     0  5710.000000            NaN   \n",
       "7                                     0     0.209940         3500.0   \n",
       "8                                     0    46.000000            NaN   \n",
       "9                                     0     0.606291        23684.0   \n",
       "\n",
       "   NumberOfOpenCreditLinesAndLoans  NumberOfTimes90DaysLate  \\\n",
       "0                               13                        0   \n",
       "1                                4                        0   \n",
       "2                                2                        1   \n",
       "3                                5                        0   \n",
       "4                                7                        0   \n",
       "5                                3                        0   \n",
       "6                                8                        0   \n",
       "7                                8                        0   \n",
       "8                                2                        0   \n",
       "9                                9                        0   \n",
       "\n",
       "   NumberRealEstateLoansOrLines  NumberOfTime60-89DaysPastDueNotWorse  \\\n",
       "0                             6                                     0   \n",
       "1                             0                                     0   \n",
       "2                             0                                     0   \n",
       "3                             0                                     0   \n",
       "4                             1                                     0   \n",
       "5                             1                                     0   \n",
       "6                             3                                     0   \n",
       "7                             0                                     0   \n",
       "8                             0                                     0   \n",
       "9                             4                                     0   \n",
       "\n",
       "   NumberOfDependents  \n",
       "0                 2.0  \n",
       "1                 1.0  \n",
       "2                 0.0  \n",
       "3                 0.0  \n",
       "4                 0.0  \n",
       "5                 1.0  \n",
       "6                 0.0  \n",
       "7                 0.0  \n",
       "8                 NaN  \n",
       "9                 2.0  "
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv('./cs-training.csv')\n",
    "data.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:07.621916Z",
     "start_time": "2021-01-03T03:34:07.522910Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SeriousDlqin2yrs</th>\n",
       "      <th>RevolvingUtilizationOfUnsecuredLines</th>\n",
       "      <th>age</th>\n",
       "      <th>NumberOfTime30-59DaysPastDueNotWorse</th>\n",
       "      <th>DebtRatio</th>\n",
       "      <th>MonthlyIncome</th>\n",
       "      <th>NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>NumberOfTimes90DaysLate</th>\n",
       "      <th>NumberRealEstateLoansOrLines</th>\n",
       "      <th>NumberOfTime60-89DaysPastDueNotWorse</th>\n",
       "      <th>NumberOfDependents</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.766127</td>\n",
       "      <td>45</td>\n",
       "      <td>2</td>\n",
       "      <td>0.802982</td>\n",
       "      <td>9120.0</td>\n",
       "      <td>13</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>0.957151</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>0.121876</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>0.658180</td>\n",
       "      <td>38</td>\n",
       "      <td>1</td>\n",
       "      <td>0.085113</td>\n",
       "      <td>3042.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>0.233810</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>0.036050</td>\n",
       "      <td>3300.0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>0.907239</td>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "      <td>0.024926</td>\n",
       "      <td>63588.0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149995</th>\n",
       "      <td>0</td>\n",
       "      <td>0.040674</td>\n",
       "      <td>74</td>\n",
       "      <td>0</td>\n",
       "      <td>0.225131</td>\n",
       "      <td>2100.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149996</th>\n",
       "      <td>0</td>\n",
       "      <td>0.299745</td>\n",
       "      <td>44</td>\n",
       "      <td>0</td>\n",
       "      <td>0.716562</td>\n",
       "      <td>5584.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149997</th>\n",
       "      <td>0</td>\n",
       "      <td>0.246044</td>\n",
       "      <td>58</td>\n",
       "      <td>0</td>\n",
       "      <td>3870.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>18</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149998</th>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>5716.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149999</th>\n",
       "      <td>0</td>\n",
       "      <td>0.850283</td>\n",
       "      <td>64</td>\n",
       "      <td>0</td>\n",
       "      <td>0.249908</td>\n",
       "      <td>8158.0</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>150000 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        SeriousDlqin2yrs  RevolvingUtilizationOfUnsecuredLines  age  \\\n",
       "0                      1                              0.766127   45   \n",
       "1                      0                              0.957151   40   \n",
       "2                      0                              0.658180   38   \n",
       "3                      0                              0.233810   30   \n",
       "4                      0                              0.907239   49   \n",
       "...                  ...                                   ...  ...   \n",
       "149995                 0                              0.040674   74   \n",
       "149996                 0                              0.299745   44   \n",
       "149997                 0                              0.246044   58   \n",
       "149998                 0                              0.000000   30   \n",
       "149999                 0                              0.850283   64   \n",
       "\n",
       "        NumberOfTime30-59DaysPastDueNotWorse    DebtRatio  MonthlyIncome  \\\n",
       "0                                          2     0.802982         9120.0   \n",
       "1                                          0     0.121876         2600.0   \n",
       "2                                          1     0.085113         3042.0   \n",
       "3                                          0     0.036050         3300.0   \n",
       "4                                          1     0.024926        63588.0   \n",
       "...                                      ...          ...            ...   \n",
       "149995                                     0     0.225131         2100.0   \n",
       "149996                                     0     0.716562         5584.0   \n",
       "149997                                     0  3870.000000            NaN   \n",
       "149998                                     0     0.000000         5716.0   \n",
       "149999                                     0     0.249908         8158.0   \n",
       "\n",
       "        NumberOfOpenCreditLinesAndLoans  NumberOfTimes90DaysLate  \\\n",
       "0                                    13                        0   \n",
       "1                                     4                        0   \n",
       "2                                     2                        1   \n",
       "3                                     5                        0   \n",
       "4                                     7                        0   \n",
       "...                                 ...                      ...   \n",
       "149995                                4                        0   \n",
       "149996                                4                        0   \n",
       "149997                               18                        0   \n",
       "149998                                4                        0   \n",
       "149999                                8                        0   \n",
       "\n",
       "        NumberRealEstateLoansOrLines  NumberOfTime60-89DaysPastDueNotWorse  \\\n",
       "0                                  6                                     0   \n",
       "1                                  0                                     0   \n",
       "2                                  0                                     0   \n",
       "3                                  0                                     0   \n",
       "4                                  1                                     0   \n",
       "...                              ...                                   ...   \n",
       "149995                             1                                     0   \n",
       "149996                             1                                     0   \n",
       "149997                             1                                     0   \n",
       "149998                             0                                     0   \n",
       "149999                             2                                     0   \n",
       "\n",
       "        NumberOfDependents  \n",
       "0                      2.0  \n",
       "1                      1.0  \n",
       "2                      0.0  \n",
       "3                      0.0  \n",
       "4                      0.0  \n",
       "...                    ...  \n",
       "149995                 0.0  \n",
       "149996                 2.0  \n",
       "149997                 0.0  \n",
       "149998                 0.0  \n",
       "149999                 0.0  \n",
       "\n",
       "[150000 rows x 11 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train = data.iloc[:,1:]\n",
    "df_train"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:07.807926Z",
     "start_time": "2021-01-03T03:34:07.628916Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>字段</th>\n",
       "      <th>说明</th>\n",
       "      <th>类型</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>SeriousDlqin2yrs</td>\n",
       "      <td>90天以上逾期或更差</td>\n",
       "      <td>Y/N</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Age</td>\n",
       "      <td>年龄</td>\n",
       "      <td>整数</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>除房地产和汽车贷款等无分期付款债务外，信用卡和个人信用额度的总余额除以信贷限额</td>\n",
       "      <td>百分比</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>DebtRatio</td>\n",
       "      <td>债务比（每月偿还的债务，赡养费，生活费除以每月的总收入）</td>\n",
       "      <td>百分比</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>MonthlyIncome</td>\n",
       "      <td>每月收入</td>\n",
       "      <td>实数</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>NumberOfOpenCreditLinesAndLoans</td>\n",
       "      <td>公开贷款(如汽车贷款或抵押贷款)和信用额度(如信用卡)的数量</td>\n",
       "      <td>整数</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>NumberRealEstateLoansOrLines</td>\n",
       "      <td>抵押贷款和房地产贷款的额度（包括房屋净值信贷）</td>\n",
       "      <td>整数</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>借款人逾期30-59天的次数，但在过去两年没有更糟</td>\n",
       "      <td>整数</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>借款人逾期60-89天的次数，但在过去两年没有更糟</td>\n",
       "      <td>整数</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>借款人逾期90天（或以上）的次数</td>\n",
       "      <td>整数</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>NumberOfDependents</td>\n",
       "      <td>除自己(配偶、子女等)以外的家庭受养人人数</td>\n",
       "      <td>整数</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                      字段  \\\n",
       "0                       SeriousDlqin2yrs   \n",
       "1                                    Age   \n",
       "2   RevolvingUtilizationOfUnsecuredLines   \n",
       "3                              DebtRatio   \n",
       "4                          MonthlyIncome   \n",
       "5        NumberOfOpenCreditLinesAndLoans   \n",
       "6           NumberRealEstateLoansOrLines   \n",
       "7   NumberOfTime30-59DaysPastDueNotWorse   \n",
       "8   NumberOfTime60-89DaysPastDueNotWorse   \n",
       "9                NumberOfTimes90DaysLate   \n",
       "10                    NumberOfDependents   \n",
       "\n",
       "                                         说明   类型  \n",
       "0                                90天以上逾期或更差  Y/N  \n",
       "1                                        年龄   整数  \n",
       "2   除房地产和汽车贷款等无分期付款债务外，信用卡和个人信用额度的总余额除以信贷限额  百分比  \n",
       "3              债务比（每月偿还的债务，赡养费，生活费除以每月的总收入）  百分比  \n",
       "4                                      每月收入   实数  \n",
       "5            公开贷款(如汽车贷款或抵押贷款)和信用额度(如信用卡)的数量   整数  \n",
       "6                   抵押贷款和房地产贷款的额度（包括房屋净值信贷）   整数  \n",
       "7                 借款人逾期30-59天的次数，但在过去两年没有更糟   整数  \n",
       "8                借款人逾期60-89天的次数，但在过去两年没有更糟    整数  \n",
       "9                          借款人逾期90天（或以上）的次数   整数  \n",
       "10                    除自己(配偶、子女等)以外的家庭受养人人数   整数  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "field_desc = pd.read_excel('./field_desc.xlsx')\n",
    "field_desc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:07.840928Z",
     "start_time": "2021-01-03T03:34:07.814927Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    139974\n",
       "1     10026\n",
       "Name: SeriousDlqin2yrs, dtype: int64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train['SeriousDlqin2yrs'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T04:38:17.254102Z",
     "start_time": "2021-01-03T04:38:16.622066Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x3104a550>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "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\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#对违约率进行可视化,1的情况比较少\n",
    "import seaborn as sns\n",
    "\n",
    "sns.countplot(x='SeriousDlqin2yrs',data=df_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:11.858158Z",
     "start_time": "2021-01-03T03:34:11.844157Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.06684"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train['SeriousDlqin2yrs'].sum() / df_train.shape[0]\n",
    "\n",
    "#违约率为%6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T04:38:42.407541Z",
     "start_time": "2021-01-03T04:38:42.355538Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SeriousDlqin2yrs                            0\n",
       "RevolvingUtilizationOfUnsecuredLines        0\n",
       "age                                         0\n",
       "NumberOfTime30-59DaysPastDueNotWorse        0\n",
       "DebtRatio                                   0\n",
       "MonthlyIncome                               0\n",
       "NumberOfOpenCreditLinesAndLoans             0\n",
       "NumberOfTimes90DaysLate                     0\n",
       "NumberRealEstateLoansOrLines                0\n",
       "NumberOfTime60-89DaysPastDueNotWorse        0\n",
       "NumberOfDependents                          0\n",
       "bin_age                                     0\n",
       "bin_NumberOfDependents                      0\n",
       "bin_NumberOfTime30-59DaysPastDueNotWorse    0\n",
       "bin_NumberOfTime60-89DaysPastDueNotWorse    0\n",
       "bin_NumberOfTimes90DaysLate                 0\n",
       "bin_RevolvingUtilizationOfUnsecuredLines    0\n",
       "bin_DebtRatio                               0\n",
       "bin_MonthlyIncome                           0\n",
       "bin_NumberOfOpenCreditLinesAndLoans         0\n",
       "bin_NumberRealEstateLoansOrLines            0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#查看有无缺失值\n",
    "df_train.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:11.930162Z",
     "start_time": "2021-01-03T03:34:11.898160Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    150000.000000\n",
       "mean          6.048438\n",
       "std         249.755371\n",
       "min           0.000000\n",
       "25%           0.029867\n",
       "50%           0.154181\n",
       "75%           0.559046\n",
       "max       50708.000000\n",
       "Name: RevolvingUtilizationOfUnsecuredLines, dtype: float64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train['RevolvingUtilizationOfUnsecuredLines'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:12.698206Z",
     "start_time": "2021-01-03T03:34:11.934162Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x2c13f278>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "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\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#用直方图画取值的分布\n",
    "sns.distplot(df_train['RevolvingUtilizationOfUnsecuredLines'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 缺失值填充"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:13.005224Z",
     "start_time": "2021-01-03T03:34:12.705206Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6762.092451637375\n",
      "5437.0\n",
      "3008750.0\n",
      "1.0\n"
     ]
    }
   ],
   "source": [
    "#MonthlyIncome:月收入  容易受大值和小值影响填充缺失值,用中位数填充\n",
    "print(df_train[df_train['MonthlyIncome']!=0]['MonthlyIncome'].mean())  #均值\n",
    "print(df_train[df_train['MonthlyIncome']!=0]['MonthlyIncome'].median())  #中位数\n",
    "print(df_train[df_train['MonthlyIncome']!=0]['MonthlyIncome'].max()) #最大值\n",
    "print(df_train[df_train['MonthlyIncome']!=0]['MonthlyIncome'].min()) #最小值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:13.105229Z",
     "start_time": "2021-01-03T03:34:13.013224Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.7572222678605657\n",
      "0.0\n",
      "20.0\n",
      "0.0\n",
      "count    146076.000000\n",
      "mean          0.757222\n",
      "std           1.115086\n",
      "min           0.000000\n",
      "25%           0.000000\n",
      "50%           0.000000\n",
      "75%           1.000000\n",
      "max          20.000000\n",
      "Name: NumberOfDependents, dtype: float64\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.0     86902\n",
       "1.0     26316\n",
       "2.0     19522\n",
       "3.0      9483\n",
       "4.0      2862\n",
       "5.0       746\n",
       "6.0       158\n",
       "7.0        51\n",
       "8.0        24\n",
       "9.0         5\n",
       "10.0        5\n",
       "13.0        1\n",
       "20.0        1\n",
       "Name: NumberOfDependents, dtype: int64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#NumberOfDependents:除自己(配偶、子女等)以外的家庭受养人人数， 用中位数填充\n",
    "print(df_train['NumberOfDependents'].mean())  #均值\n",
    "print(df_train['NumberOfDependents'].median())  #中位数\n",
    "print(df_train['NumberOfDependents'].max())  #最大值\n",
    "print(df_train['NumberOfDependents'].min())  #最小值\n",
    "print(df_train.NumberOfDependents.describe())\n",
    "df_train.NumberOfDependents.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:13.293240Z",
     "start_time": "2021-01-03T03:34:13.117230Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 150000 entries, 0 to 149999\n",
      "Data columns (total 11 columns):\n",
      " #   Column                                Non-Null Count   Dtype  \n",
      "---  ------                                --------------   -----  \n",
      " 0   SeriousDlqin2yrs                      150000 non-null  int64  \n",
      " 1   RevolvingUtilizationOfUnsecuredLines  150000 non-null  float64\n",
      " 2   age                                   150000 non-null  int64  \n",
      " 3   NumberOfTime30-59DaysPastDueNotWorse  150000 non-null  int64  \n",
      " 4   DebtRatio                             150000 non-null  float64\n",
      " 5   MonthlyIncome                         150000 non-null  float64\n",
      " 6   NumberOfOpenCreditLinesAndLoans       150000 non-null  int64  \n",
      " 7   NumberOfTimes90DaysLate               150000 non-null  int64  \n",
      " 8   NumberRealEstateLoansOrLines          150000 non-null  int64  \n",
      " 9   NumberOfTime60-89DaysPastDueNotWorse  150000 non-null  int64  \n",
      " 10  NumberOfDependents                    150000 non-null  float64\n",
      "dtypes: float64(4), int64(7)\n",
      "memory usage: 12.6 MB\n"
     ]
    }
   ],
   "source": [
    "#用中位数填充\n",
    "df_train = df_train.fillna(df_train.median())\n",
    "df_train.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据分箱"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:13.402246Z",
     "start_time": "2021-01-03T03:34:13.306241Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>age</th>\n",
       "      <th>bin_age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>45</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>40</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>38</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>30</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>49</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149995</th>\n",
       "      <td>74</td>\n",
       "      <td>(70.0, inf]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149996</th>\n",
       "      <td>44</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149997</th>\n",
       "      <td>58</td>\n",
       "      <td>(50.0, 60.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149998</th>\n",
       "      <td>30</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149999</th>\n",
       "      <td>64</td>\n",
       "      <td>(60.0, 70.0]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>150000 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        age       bin_age\n",
       "0        45  (40.0, 50.0]\n",
       "1        40  (25.0, 40.0]\n",
       "2        38  (25.0, 40.0]\n",
       "3        30  (25.0, 40.0]\n",
       "4        49  (40.0, 50.0]\n",
       "...     ...           ...\n",
       "149995   74   (70.0, inf]\n",
       "149996   44  (40.0, 50.0]\n",
       "149997   58  (50.0, 60.0]\n",
       "149998   30  (25.0, 40.0]\n",
       "149999   64  (60.0, 70.0]\n",
       "\n",
       "[150000 rows x 2 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#对age字段进行分箱\n",
    "import math\n",
    "\n",
    "age_bins = [-math.inf,25, 40,50,60,70, math.inf]\n",
    "df_train['bin_age'] = pd.cut(df_train['age'], bins=age_bins)\n",
    "df_train[['age','bin_age']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:13.508252Z",
     "start_time": "2021-01-03T03:34:13.408247Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NumberOfDependents</th>\n",
       "      <th>bin_NumberOfDependents</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149995</th>\n",
       "      <td>0.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149996</th>\n",
       "      <td>2.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149997</th>\n",
       "      <td>0.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149998</th>\n",
       "      <td>0.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149999</th>\n",
       "      <td>0.0</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>150000 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        NumberOfDependents bin_NumberOfDependents\n",
       "0                      2.0            (-inf, 2.0]\n",
       "1                      1.0            (-inf, 2.0]\n",
       "2                      0.0            (-inf, 2.0]\n",
       "3                      0.0            (-inf, 2.0]\n",
       "4                      0.0            (-inf, 2.0]\n",
       "...                    ...                    ...\n",
       "149995                 0.0            (-inf, 2.0]\n",
       "149996                 2.0            (-inf, 2.0]\n",
       "149997                 0.0            (-inf, 2.0]\n",
       "149998                 0.0            (-inf, 2.0]\n",
       "149999                 0.0            (-inf, 2.0]\n",
       "\n",
       "[150000 rows x 2 columns]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#NumberOfDependents:除自己(配偶、子女等)以外的家庭受养人人数   分箱\n",
    "dependent_bins = [-math.inf, 2, 4, 6, 8, 10, math.inf]\n",
    "df_train['bin_NumberOfDependents'] = pd.cut(df_train['NumberOfDependents'], bins= dependent_bins)\n",
    "df_train[['NumberOfDependents','bin_NumberOfDependents']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:13.677262Z",
     "start_time": "2021-01-03T03:34:13.514253Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>bin_NumberOfTime30-59DaysPastDueNotWorse</th>\n",
       "      <th>bin_NumberOfTime60-89DaysPastDueNotWorse</th>\n",
       "      <th>bin_NumberOfTimes90DaysLate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149995</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149996</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149997</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149998</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149999</th>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>150000 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       bin_NumberOfTime30-59DaysPastDueNotWorse  \\\n",
       "0                                    (1.0, 2.0]   \n",
       "1                                   (-inf, 1.0]   \n",
       "2                                   (-inf, 1.0]   \n",
       "3                                   (-inf, 1.0]   \n",
       "4                                   (-inf, 1.0]   \n",
       "...                                         ...   \n",
       "149995                              (-inf, 1.0]   \n",
       "149996                              (-inf, 1.0]   \n",
       "149997                              (-inf, 1.0]   \n",
       "149998                              (-inf, 1.0]   \n",
       "149999                              (-inf, 1.0]   \n",
       "\n",
       "       bin_NumberOfTime60-89DaysPastDueNotWorse bin_NumberOfTimes90DaysLate  \n",
       "0                                   (-inf, 1.0]                 (-inf, 1.0]  \n",
       "1                                   (-inf, 1.0]                 (-inf, 1.0]  \n",
       "2                                   (-inf, 1.0]                 (-inf, 1.0]  \n",
       "3                                   (-inf, 1.0]                 (-inf, 1.0]  \n",
       "4                                   (-inf, 1.0]                 (-inf, 1.0]  \n",
       "...                                         ...                         ...  \n",
       "149995                              (-inf, 1.0]                 (-inf, 1.0]  \n",
       "149996                              (-inf, 1.0]                 (-inf, 1.0]  \n",
       "149997                              (-inf, 1.0]                 (-inf, 1.0]  \n",
       "149998                              (-inf, 1.0]                 (-inf, 1.0]  \n",
       "149999                              (-inf, 1.0]                 (-inf, 1.0]  \n",
       "\n",
       "[150000 rows x 3 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#对于3种逾期次数NumberOfTime30-59DaysPastDueNotWorse，NumberOfTime60-89DaysPastDueNotWorse， NumberOfTimes90DaysLate 分箱\n",
    "dpd_bins = [-math.inf, 1, 2, 3, 4, 5, 6, 7, 8, 9, math.inf]\n",
    "df_train['bin_NumberOfTime30-59DaysPastDueNotWorse']= pd.cut(df_train['NumberOfTime30-59DaysPastDueNotWorse'], bins=dpd_bins)\n",
    "df_train['bin_NumberOfTime60-89DaysPastDueNotWorse']= pd.cut(df_train['NumberOfTime60-89DaysPastDueNotWorse'], bins=dpd_bins)\n",
    "df_train['bin_NumberOfTimes90DaysLate']= pd.cut(df_train['NumberOfTimes90DaysLate'], bins=dpd_bins)\n",
    "#查看分箱情况\n",
    "df_train[['bin_NumberOfTime30-59DaysPastDueNotWorse','bin_NumberOfTime60-89DaysPastDueNotWorse','bin_NumberOfTimes90DaysLate']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:14.308298Z",
     "start_time": "2021-01-03T03:34:13.683262Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SeriousDlqin2yrs</th>\n",
       "      <th>RevolvingUtilizationOfUnsecuredLines</th>\n",
       "      <th>age</th>\n",
       "      <th>NumberOfTime30-59DaysPastDueNotWorse</th>\n",
       "      <th>DebtRatio</th>\n",
       "      <th>MonthlyIncome</th>\n",
       "      <th>NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>NumberOfTimes90DaysLate</th>\n",
       "      <th>NumberRealEstateLoansOrLines</th>\n",
       "      <th>NumberOfTime60-89DaysPastDueNotWorse</th>\n",
       "      <th>...</th>\n",
       "      <th>bin_age</th>\n",
       "      <th>bin_NumberOfDependents</th>\n",
       "      <th>bin_NumberOfTime30-59DaysPastDueNotWorse</th>\n",
       "      <th>bin_NumberOfTime60-89DaysPastDueNotWorse</th>\n",
       "      <th>bin_NumberOfTimes90DaysLate</th>\n",
       "      <th>bin_RevolvingUtilizationOfUnsecuredLines</th>\n",
       "      <th>bin_DebtRatio</th>\n",
       "      <th>bin_MonthlyIncome</th>\n",
       "      <th>bin_NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>bin_NumberRealEstateLoansOrLines</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.766127</td>\n",
       "      <td>45</td>\n",
       "      <td>2</td>\n",
       "      <td>0.802982</td>\n",
       "      <td>9120.0</td>\n",
       "      <td>13</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.699, 50708.0]</td>\n",
       "      <td>(0.468, 4.0]</td>\n",
       "      <td>(8250.0, 3008750.0]</td>\n",
       "      <td>(12.0, 58.0]</td>\n",
       "      <td>(2.0, 54.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>0.957151</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>0.121876</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.699, 50708.0]</td>\n",
       "      <td>(-0.001, 0.134]</td>\n",
       "      <td>(-0.001, 3400.0]</td>\n",
       "      <td>(-0.001, 4.0]</td>\n",
       "      <td>(-0.001, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>0.658180</td>\n",
       "      <td>38</td>\n",
       "      <td>1</td>\n",
       "      <td>0.085113</td>\n",
       "      <td>3042.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.271, 0.699]</td>\n",
       "      <td>(-0.001, 0.134]</td>\n",
       "      <td>(-0.001, 3400.0]</td>\n",
       "      <td>(-0.001, 4.0]</td>\n",
       "      <td>(-0.001, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>0.233810</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>0.036050</td>\n",
       "      <td>3300.0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.0832, 0.271]</td>\n",
       "      <td>(-0.001, 0.134]</td>\n",
       "      <td>(-0.001, 3400.0]</td>\n",
       "      <td>(4.0, 6.0]</td>\n",
       "      <td>(-0.001, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>0.907239</td>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "      <td>0.024926</td>\n",
       "      <td>63588.0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.699, 50708.0]</td>\n",
       "      <td>(-0.001, 0.134]</td>\n",
       "      <td>(8250.0, 3008750.0]</td>\n",
       "      <td>(6.0, 9.0]</td>\n",
       "      <td>(-0.001, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149995</th>\n",
       "      <td>0</td>\n",
       "      <td>0.040674</td>\n",
       "      <td>74</td>\n",
       "      <td>0</td>\n",
       "      <td>0.225131</td>\n",
       "      <td>2100.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(70.0, inf]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.0192, 0.0832]</td>\n",
       "      <td>(0.134, 0.287]</td>\n",
       "      <td>(-0.001, 3400.0]</td>\n",
       "      <td>(-0.001, 4.0]</td>\n",
       "      <td>(-0.001, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149996</th>\n",
       "      <td>0</td>\n",
       "      <td>0.299745</td>\n",
       "      <td>44</td>\n",
       "      <td>0</td>\n",
       "      <td>0.716562</td>\n",
       "      <td>5584.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.271, 0.699]</td>\n",
       "      <td>(0.468, 4.0]</td>\n",
       "      <td>(5400.0, 8250.0]</td>\n",
       "      <td>(-0.001, 4.0]</td>\n",
       "      <td>(-0.001, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149997</th>\n",
       "      <td>0</td>\n",
       "      <td>0.246044</td>\n",
       "      <td>58</td>\n",
       "      <td>0</td>\n",
       "      <td>3870.000000</td>\n",
       "      <td>5400.0</td>\n",
       "      <td>18</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(50.0, 60.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.0832, 0.271]</td>\n",
       "      <td>(4.0, 329664.0]</td>\n",
       "      <td>(3400.0, 5400.0]</td>\n",
       "      <td>(12.0, 58.0]</td>\n",
       "      <td>(-0.001, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149998</th>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>5716.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-0.001, 0.0192]</td>\n",
       "      <td>(-0.001, 0.134]</td>\n",
       "      <td>(5400.0, 8250.0]</td>\n",
       "      <td>(-0.001, 4.0]</td>\n",
       "      <td>(-0.001, 1.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149999</th>\n",
       "      <td>0</td>\n",
       "      <td>0.850283</td>\n",
       "      <td>64</td>\n",
       "      <td>0</td>\n",
       "      <td>0.249908</td>\n",
       "      <td>8158.0</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>(60.0, 70.0]</td>\n",
       "      <td>(-inf, 2.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>(0.699, 50708.0]</td>\n",
       "      <td>(0.134, 0.287]</td>\n",
       "      <td>(5400.0, 8250.0]</td>\n",
       "      <td>(6.0, 9.0]</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>150000 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        SeriousDlqin2yrs  RevolvingUtilizationOfUnsecuredLines  age  \\\n",
       "0                      1                              0.766127   45   \n",
       "1                      0                              0.957151   40   \n",
       "2                      0                              0.658180   38   \n",
       "3                      0                              0.233810   30   \n",
       "4                      0                              0.907239   49   \n",
       "...                  ...                                   ...  ...   \n",
       "149995                 0                              0.040674   74   \n",
       "149996                 0                              0.299745   44   \n",
       "149997                 0                              0.246044   58   \n",
       "149998                 0                              0.000000   30   \n",
       "149999                 0                              0.850283   64   \n",
       "\n",
       "        NumberOfTime30-59DaysPastDueNotWorse    DebtRatio  MonthlyIncome  \\\n",
       "0                                          2     0.802982         9120.0   \n",
       "1                                          0     0.121876         2600.0   \n",
       "2                                          1     0.085113         3042.0   \n",
       "3                                          0     0.036050         3300.0   \n",
       "4                                          1     0.024926        63588.0   \n",
       "...                                      ...          ...            ...   \n",
       "149995                                     0     0.225131         2100.0   \n",
       "149996                                     0     0.716562         5584.0   \n",
       "149997                                     0  3870.000000         5400.0   \n",
       "149998                                     0     0.000000         5716.0   \n",
       "149999                                     0     0.249908         8158.0   \n",
       "\n",
       "        NumberOfOpenCreditLinesAndLoans  NumberOfTimes90DaysLate  \\\n",
       "0                                    13                        0   \n",
       "1                                     4                        0   \n",
       "2                                     2                        1   \n",
       "3                                     5                        0   \n",
       "4                                     7                        0   \n",
       "...                                 ...                      ...   \n",
       "149995                                4                        0   \n",
       "149996                                4                        0   \n",
       "149997                               18                        0   \n",
       "149998                                4                        0   \n",
       "149999                                8                        0   \n",
       "\n",
       "        NumberRealEstateLoansOrLines  NumberOfTime60-89DaysPastDueNotWorse  \\\n",
       "0                                  6                                     0   \n",
       "1                                  0                                     0   \n",
       "2                                  0                                     0   \n",
       "3                                  0                                     0   \n",
       "4                                  1                                     0   \n",
       "...                              ...                                   ...   \n",
       "149995                             1                                     0   \n",
       "149996                             1                                     0   \n",
       "149997                             1                                     0   \n",
       "149998                             0                                     0   \n",
       "149999                             2                                     0   \n",
       "\n",
       "        ...       bin_age bin_NumberOfDependents  \\\n",
       "0       ...  (40.0, 50.0]            (-inf, 2.0]   \n",
       "1       ...  (25.0, 40.0]            (-inf, 2.0]   \n",
       "2       ...  (25.0, 40.0]            (-inf, 2.0]   \n",
       "3       ...  (25.0, 40.0]            (-inf, 2.0]   \n",
       "4       ...  (40.0, 50.0]            (-inf, 2.0]   \n",
       "...     ...           ...                    ...   \n",
       "149995  ...   (70.0, inf]            (-inf, 2.0]   \n",
       "149996  ...  (40.0, 50.0]            (-inf, 2.0]   \n",
       "149997  ...  (50.0, 60.0]            (-inf, 2.0]   \n",
       "149998  ...  (25.0, 40.0]            (-inf, 2.0]   \n",
       "149999  ...  (60.0, 70.0]            (-inf, 2.0]   \n",
       "\n",
       "       bin_NumberOfTime30-59DaysPastDueNotWorse  \\\n",
       "0                                    (1.0, 2.0]   \n",
       "1                                   (-inf, 1.0]   \n",
       "2                                   (-inf, 1.0]   \n",
       "3                                   (-inf, 1.0]   \n",
       "4                                   (-inf, 1.0]   \n",
       "...                                         ...   \n",
       "149995                              (-inf, 1.0]   \n",
       "149996                              (-inf, 1.0]   \n",
       "149997                              (-inf, 1.0]   \n",
       "149998                              (-inf, 1.0]   \n",
       "149999                              (-inf, 1.0]   \n",
       "\n",
       "       bin_NumberOfTime60-89DaysPastDueNotWorse bin_NumberOfTimes90DaysLate  \\\n",
       "0                                   (-inf, 1.0]                 (-inf, 1.0]   \n",
       "1                                   (-inf, 1.0]                 (-inf, 1.0]   \n",
       "2                                   (-inf, 1.0]                 (-inf, 1.0]   \n",
       "3                                   (-inf, 1.0]                 (-inf, 1.0]   \n",
       "4                                   (-inf, 1.0]                 (-inf, 1.0]   \n",
       "...                                         ...                         ...   \n",
       "149995                              (-inf, 1.0]                 (-inf, 1.0]   \n",
       "149996                              (-inf, 1.0]                 (-inf, 1.0]   \n",
       "149997                              (-inf, 1.0]                 (-inf, 1.0]   \n",
       "149998                              (-inf, 1.0]                 (-inf, 1.0]   \n",
       "149999                              (-inf, 1.0]                 (-inf, 1.0]   \n",
       "\n",
       "       bin_RevolvingUtilizationOfUnsecuredLines    bin_DebtRatio  \\\n",
       "0                              (0.699, 50708.0]     (0.468, 4.0]   \n",
       "1                              (0.699, 50708.0]  (-0.001, 0.134]   \n",
       "2                                (0.271, 0.699]  (-0.001, 0.134]   \n",
       "3                               (0.0832, 0.271]  (-0.001, 0.134]   \n",
       "4                              (0.699, 50708.0]  (-0.001, 0.134]   \n",
       "...                                         ...              ...   \n",
       "149995                         (0.0192, 0.0832]   (0.134, 0.287]   \n",
       "149996                           (0.271, 0.699]     (0.468, 4.0]   \n",
       "149997                          (0.0832, 0.271]  (4.0, 329664.0]   \n",
       "149998                         (-0.001, 0.0192]  (-0.001, 0.134]   \n",
       "149999                         (0.699, 50708.0]   (0.134, 0.287]   \n",
       "\n",
       "          bin_MonthlyIncome bin_NumberOfOpenCreditLinesAndLoans  \\\n",
       "0       (8250.0, 3008750.0]                        (12.0, 58.0]   \n",
       "1          (-0.001, 3400.0]                       (-0.001, 4.0]   \n",
       "2          (-0.001, 3400.0]                       (-0.001, 4.0]   \n",
       "3          (-0.001, 3400.0]                          (4.0, 6.0]   \n",
       "4       (8250.0, 3008750.0]                          (6.0, 9.0]   \n",
       "...                     ...                                 ...   \n",
       "149995     (-0.001, 3400.0]                       (-0.001, 4.0]   \n",
       "149996     (5400.0, 8250.0]                       (-0.001, 4.0]   \n",
       "149997     (3400.0, 5400.0]                        (12.0, 58.0]   \n",
       "149998     (5400.0, 8250.0]                       (-0.001, 4.0]   \n",
       "149999     (5400.0, 8250.0]                          (6.0, 9.0]   \n",
       "\n",
       "       bin_NumberRealEstateLoansOrLines  \n",
       "0                           (2.0, 54.0]  \n",
       "1                         (-0.001, 1.0]  \n",
       "2                         (-0.001, 1.0]  \n",
       "3                         (-0.001, 1.0]  \n",
       "4                         (-0.001, 1.0]  \n",
       "...                                 ...  \n",
       "149995                    (-0.001, 1.0]  \n",
       "149996                    (-0.001, 1.0]  \n",
       "149997                    (-0.001, 1.0]  \n",
       "149998                    (-0.001, 1.0]  \n",
       "149999                       (1.0, 2.0]  \n",
       "\n",
       "[150000 rows x 21 columns]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#对其余字段也做分箱处理\n",
    "#RevolvingUtilizationOfUnsecuredLines,DebtRatio,,MonthlyIncome,NumberOfOpenCreditLinesAndLoans,NumberRealEstateLoansOrLines\n",
    "#RevolvingUtilizationOfUnsecuredLines\t除房地产和汽车贷款等无分期付款债务外，信用卡和个人信用额度的总余额除以信贷限额\n",
    "df_train['bin_RevolvingUtilizationOfUnsecuredLines'] = pd.qcut(df_train['RevolvingUtilizationOfUnsecuredLines'], q=5, duplicates='drop')\n",
    "\n",
    "#DebtRatio\t债务比（每月偿还的债务，赡养费，生活费除以每月的总收入）\n",
    "df_train['bin_DebtRatio'] = pd.qcut(df_train['DebtRatio'], q=5, duplicates='drop')\n",
    "\n",
    "#MonthlyIncome\t每月收入\n",
    "df_train['bin_MonthlyIncome'] = pd.qcut(df_train['MonthlyIncome'], q=5, duplicates='drop')\n",
    "\n",
    "#NumberOfOpenCreditLinesAndLoans\t公开贷款(如汽车贷款或抵押贷款)和信用额度(如信用卡)的数量\n",
    "df_train['bin_NumberOfOpenCreditLinesAndLoans'] = pd.qcut(df_train['NumberOfOpenCreditLinesAndLoans'], q=5, duplicates='drop')\n",
    "\n",
    "#NumberRealEstateLoansOrLines\t抵押贷款和房地产贷款的额度（包括房屋净值信贷）\n",
    "df_train['bin_NumberRealEstateLoansOrLines'] = pd.qcut(df_train['NumberRealEstateLoansOrLines'], q=5, duplicates='drop')\n",
    "\n",
    "df_train\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:14.347300Z",
     "start_time": "2021-01-03T03:34:14.315299Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.699, 50708.0]    30000\n",
       "(0.271, 0.699]      30000\n",
       "(0.0832, 0.271]     30000\n",
       "(0.0192, 0.0832]    30000\n",
       "(-0.001, 0.0192]    30000\n",
       "Name: bin_RevolvingUtilizationOfUnsecuredLines, dtype: int64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train['bin_RevolvingUtilizationOfUnsecuredLines'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:14.384303Z",
     "start_time": "2021-01-03T03:34:14.355301Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.468, 4.0]       30109\n",
       "(0.287, 0.468]     30000\n",
       "(0.134, 0.287]     30000\n",
       "(-0.001, 0.134]    30000\n",
       "(4.0, 329664.0]    29891\n",
       "Name: bin_DebtRatio, dtype: int64"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train['bin_DebtRatio'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:14.426305Z",
     "start_time": "2021-01-03T03:34:14.393303Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3400.0, 5400.0]       59757\n",
       "(-0.001, 3400.0]       30289\n",
       "(8250.0, 3008750.0]    29993\n",
       "(5400.0, 8250.0]       29961\n",
       "Name: bin_MonthlyIncome, dtype: int64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#分箱合并了\n",
    "df_train['bin_MonthlyIncome'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:14.479308Z",
     "start_time": "2021-01-03T03:34:14.433305Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5400.0     30062\n",
       "5000.0      2757\n",
       "4000.0      2106\n",
       "6000.0      1934\n",
       "3000.0      1758\n",
       "           ...  \n",
       "3847.0         1\n",
       "10113.0        1\n",
       "14210.0        1\n",
       "13023.0        1\n",
       "1037.0         1\n",
       "Name: MonthlyIncome, Length: 13594, dtype: int64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train['MonthlyIncome'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:14.536311Z",
     "start_time": "2021-01-03T03:34:14.486308Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(-0.001, 1.0]    108526\n",
       "(1.0, 2.0]        31522\n",
       "(2.0, 54.0]        9952\n",
       "Name: bin_NumberRealEstateLoansOrLines, dtype: int64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#分箱合并了\n",
    "df_train['bin_NumberRealEstateLoansOrLines'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:14.570313Z",
     "start_time": "2021-01-03T03:34:14.546312Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     56188\n",
       "1     52338\n",
       "2     31522\n",
       "3      6300\n",
       "4      2170\n",
       "5       689\n",
       "6       320\n",
       "7       171\n",
       "8        93\n",
       "9        78\n",
       "10       37\n",
       "11       23\n",
       "12       18\n",
       "13       15\n",
       "14        7\n",
       "15        7\n",
       "16        4\n",
       "17        4\n",
       "25        3\n",
       "18        2\n",
       "19        2\n",
       "20        2\n",
       "23        2\n",
       "32        1\n",
       "21        1\n",
       "26        1\n",
       "29        1\n",
       "54        1\n",
       "Name: NumberRealEstateLoansOrLines, dtype: int64"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_train['NumberRealEstateLoansOrLines'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:14.595315Z",
     "start_time": "2021-01-03T03:34:14.577314Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['bin_age',\n",
       " 'bin_NumberOfDependents',\n",
       " 'bin_NumberOfTime30-59DaysPastDueNotWorse',\n",
       " 'bin_NumberOfTime60-89DaysPastDueNotWorse',\n",
       " 'bin_NumberOfTimes90DaysLate',\n",
       " 'bin_RevolvingUtilizationOfUnsecuredLines',\n",
       " 'bin_DebtRatio',\n",
       " 'bin_MonthlyIncome',\n",
       " 'bin_NumberOfOpenCreditLinesAndLoans',\n",
       " 'bin_NumberRealEstateLoansOrLines']"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#统计分箱字段\n",
    "bin_cols = [c for c in df_train.columns.values if c.startswith('bin_')]\n",
    "bin_cols"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 特征筛选"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T04:59:29.135850Z",
     "start_time": "2021-01-03T04:59:29.113848Z"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "#计算IV，衡量变量的区分能力\n",
    "def cal_IV(df, feature, target):\n",
    "    lst =[]\n",
    "\n",
    "    cols =[\"Variable\", 'Value', \"All\", 'Bad']\n",
    "    #对feature字段中的每个分箱取值进行遍历\n",
    "    for i in range(df[feature].nunique()):\n",
    "        #得到feature字段的第i个分箱取值val\n",
    "        val = list(df[feature].unique())[i]\n",
    "        print(val)\n",
    "        temp = df[df[feature]==val][target]\n",
    "        #统计feature，feature_value,这个value的个数，这个value导致target=1的个数\n",
    "        lst.append([feature, val, len(temp),temp.sum()])\n",
    "        \n",
    "    #print(lst)\n",
    "    data = pd.DataFrame(lst, columns=cols)   \n",
    "    data = data[data['Bad'] > 0]\n",
    "    \n",
    "    #这个分箱中的样本数占所有分箱样本数的比例\n",
    "    data['Share'] = data['All'] / data['All'].sum()   \n",
    "    \n",
    "    #这个分箱中的Bad和All的比例数，估算出这个value(分箱范围内的value)对bad的影响情况\n",
    "    data['Bad Rate'] = data['Bad'] / data['All'] \n",
    "    \n",
    "    #边际坏人占比\n",
    "    data['Margin Bad'] = data['Bad'] / data['Bad'].sum()\n",
    "    \n",
    "    #边际好人占比\n",
    "    data['Margin Good'] = (data['All'] - data['Bad']) / (data['All'].sum() - data['Bad'].sum())\n",
    "    \n",
    "    \n",
    "    data['woe'] = np.log(data['Margin Bad'] / data['Margin Good'])\n",
    "    data['iv'] = (data['woe'] * (data['Margin Bad'] - data['Margin Good'])).sum()\n",
    "    data = data.sort_values(by=(['Variable','Value']))\n",
    "    #print(data)\n",
    "    return data['iv'].values[0]\n",
    "#cal_IV(df_train, 'bin_age', 'SeriousDlqin2yrs') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:16.875445Z",
     "start_time": "2021-01-03T03:34:14.638317Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>feature</th>\n",
       "      <th>iv</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>bin_RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>1.059619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>bin_NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>0.492445</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>bin_NumberOfTimes90DaysLate</td>\n",
       "      <td>0.491607</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>bin_NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>0.266559</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>bin_age</td>\n",
       "      <td>0.240411</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>bin_DebtRatio</td>\n",
       "      <td>0.059488</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>bin_MonthlyIncome</td>\n",
       "      <td>0.056234</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>bin_NumberOfOpenCreditLinesAndLoans</td>\n",
       "      <td>0.048023</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>bin_NumberOfDependents</td>\n",
       "      <td>0.014508</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>bin_NumberRealEstateLoansOrLines</td>\n",
       "      <td>0.012091</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                    feature        iv\n",
       "5  bin_RevolvingUtilizationOfUnsecuredLines  1.059619\n",
       "2  bin_NumberOfTime30-59DaysPastDueNotWorse  0.492445\n",
       "4               bin_NumberOfTimes90DaysLate  0.491607\n",
       "3  bin_NumberOfTime60-89DaysPastDueNotWorse  0.266559\n",
       "0                                   bin_age  0.240411\n",
       "6                             bin_DebtRatio  0.059488\n",
       "7                         bin_MonthlyIncome  0.056234\n",
       "8       bin_NumberOfOpenCreditLinesAndLoans  0.048023\n",
       "1                    bin_NumberOfDependents  0.014508\n",
       "9          bin_NumberRealEstateLoansOrLines  0.012091"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#计算每个字段的iv值\n",
    "lst2=[]\n",
    "cols2=['feature','iv']\n",
    "for f in bin_cols:\n",
    "    lst2.append([f, cal_IV(df_train,f,'SeriousDlqin2yrs')])\n",
    "\n",
    "#按iv值从大到小排序\n",
    "data2 = pd.DataFrame(lst2, columns=cols2)\n",
    "data2.sort_values(by=['iv'], ascending=False, inplace=True)\n",
    "data2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:16.908447Z",
     "start_time": "2021-01-03T03:34:16.881445Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>feature</th>\n",
       "      <th>iv</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>bin_RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>1.059619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>bin_NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>0.492445</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>bin_NumberOfTimes90DaysLate</td>\n",
       "      <td>0.491607</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>bin_NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>0.266559</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>bin_age</td>\n",
       "      <td>0.240411</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                    feature        iv\n",
       "5  bin_RevolvingUtilizationOfUnsecuredLines  1.059619\n",
       "2  bin_NumberOfTime30-59DaysPastDueNotWorse  0.492445\n",
       "4               bin_NumberOfTimes90DaysLate  0.491607\n",
       "3  bin_NumberOfTime60-89DaysPastDueNotWorse  0.266559\n",
       "0                                   bin_age  0.240411"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#只选择iv值大于0.1的feature\n",
    "result = data2[data2['iv']>0.1]\n",
    "result"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 计算WOE"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:16.934448Z",
     "start_time": "2021-01-03T03:34:16.916447Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:2: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  \n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "['RevolvingUtilizationOfUnsecuredLines',\n",
       " 'NumberOfTime30-59DaysPastDueNotWorse',\n",
       " 'NumberOfTimes90DaysLate',\n",
       " 'NumberOfTime60-89DaysPastDueNotWorse',\n",
       " 'age']"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#对应到原始数据中的iv值大于0.1的特征值\n",
    "result['org_feature'] = result['feature'].str.replace('bin_','')\n",
    "feature_cols = list(result['org_feature'].values)\n",
    "feature_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T06:55:01.227343Z",
     "start_time": "2021-01-03T06:54:57.873151Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SeriousDlqin2yrs</th>\n",
       "      <th>RevolvingUtilizationOfUnsecuredLines</th>\n",
       "      <th>age</th>\n",
       "      <th>NumberOfTime30-59DaysPastDueNotWorse</th>\n",
       "      <th>DebtRatio</th>\n",
       "      <th>MonthlyIncome</th>\n",
       "      <th>NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>NumberOfTimes90DaysLate</th>\n",
       "      <th>NumberRealEstateLoansOrLines</th>\n",
       "      <th>NumberOfTime60-89DaysPastDueNotWorse</th>\n",
       "      <th>...</th>\n",
       "      <th>good_bin_NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>margin_bad_bin_NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>margin_good_bin_NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>woe_bin_NumberOfOpenCreditLinesAndLoans</th>\n",
       "      <th>bad_bin_NumberRealEstateLoansOrLines</th>\n",
       "      <th>all_bin_NumberRealEstateLoansOrLines</th>\n",
       "      <th>good_bin_NumberRealEstateLoansOrLines</th>\n",
       "      <th>margin_bad_bin_NumberRealEstateLoansOrLines</th>\n",
       "      <th>margin_good_bin_NumberRealEstateLoansOrLines</th>\n",
       "      <th>woe_bin_NumberRealEstateLoansOrLines</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.766127</td>\n",
       "      <td>45</td>\n",
       "      <td>2</td>\n",
       "      <td>0.802982</td>\n",
       "      <td>9120.0</td>\n",
       "      <td>13</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>25838</td>\n",
       "      <td>0.184121</td>\n",
       "      <td>0.184591</td>\n",
       "      <td>0.691873</td>\n",
       "      <td>841</td>\n",
       "      <td>9952</td>\n",
       "      <td>9111</td>\n",
       "      <td>0.083882</td>\n",
       "      <td>0.065091</td>\n",
       "      <td>0.827981</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>0.957151</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>0.121876</td>\n",
       "      <td>2600.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>30556</td>\n",
       "      <td>0.309495</td>\n",
       "      <td>0.218298</td>\n",
       "      <td>0.882845</td>\n",
       "      <td>7420</td>\n",
       "      <td>108526</td>\n",
       "      <td>101106</td>\n",
       "      <td>0.740076</td>\n",
       "      <td>0.722320</td>\n",
       "      <td>0.705363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>0.658180</td>\n",
       "      <td>38</td>\n",
       "      <td>1</td>\n",
       "      <td>0.085113</td>\n",
       "      <td>3042.0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>30556</td>\n",
       "      <td>0.309495</td>\n",
       "      <td>0.218298</td>\n",
       "      <td>0.882845</td>\n",
       "      <td>7420</td>\n",
       "      <td>108526</td>\n",
       "      <td>101106</td>\n",
       "      <td>0.740076</td>\n",
       "      <td>0.722320</td>\n",
       "      <td>0.705363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>0.233810</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>0.036050</td>\n",
       "      <td>3300.0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>24972</td>\n",
       "      <td>0.156892</td>\n",
       "      <td>0.178405</td>\n",
       "      <td>0.630962</td>\n",
       "      <td>7420</td>\n",
       "      <td>108526</td>\n",
       "      <td>101106</td>\n",
       "      <td>0.740076</td>\n",
       "      <td>0.722320</td>\n",
       "      <td>0.705363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>0.907239</td>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "      <td>0.024926</td>\n",
       "      <td>63588.0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>35145</td>\n",
       "      <td>0.201177</td>\n",
       "      <td>0.251082</td>\n",
       "      <td>0.588475</td>\n",
       "      <td>7420</td>\n",
       "      <td>108526</td>\n",
       "      <td>101106</td>\n",
       "      <td>0.740076</td>\n",
       "      <td>0.722320</td>\n",
       "      <td>0.705363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149995</th>\n",
       "      <td>0</td>\n",
       "      <td>0.040674</td>\n",
       "      <td>74</td>\n",
       "      <td>0</td>\n",
       "      <td>0.225131</td>\n",
       "      <td>2100.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>30556</td>\n",
       "      <td>0.309495</td>\n",
       "      <td>0.218298</td>\n",
       "      <td>0.882845</td>\n",
       "      <td>7420</td>\n",
       "      <td>108526</td>\n",
       "      <td>101106</td>\n",
       "      <td>0.740076</td>\n",
       "      <td>0.722320</td>\n",
       "      <td>0.705363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149996</th>\n",
       "      <td>0</td>\n",
       "      <td>0.299745</td>\n",
       "      <td>44</td>\n",
       "      <td>0</td>\n",
       "      <td>0.716562</td>\n",
       "      <td>5584.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>30556</td>\n",
       "      <td>0.309495</td>\n",
       "      <td>0.218298</td>\n",
       "      <td>0.882845</td>\n",
       "      <td>7420</td>\n",
       "      <td>108526</td>\n",
       "      <td>101106</td>\n",
       "      <td>0.740076</td>\n",
       "      <td>0.722320</td>\n",
       "      <td>0.705363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149997</th>\n",
       "      <td>0</td>\n",
       "      <td>0.246044</td>\n",
       "      <td>58</td>\n",
       "      <td>0</td>\n",
       "      <td>3870.000000</td>\n",
       "      <td>5400.0</td>\n",
       "      <td>18</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>25838</td>\n",
       "      <td>0.184121</td>\n",
       "      <td>0.184591</td>\n",
       "      <td>0.691873</td>\n",
       "      <td>7420</td>\n",
       "      <td>108526</td>\n",
       "      <td>101106</td>\n",
       "      <td>0.740076</td>\n",
       "      <td>0.722320</td>\n",
       "      <td>0.705363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149998</th>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>5716.0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>30556</td>\n",
       "      <td>0.309495</td>\n",
       "      <td>0.218298</td>\n",
       "      <td>0.882845</td>\n",
       "      <td>7420</td>\n",
       "      <td>108526</td>\n",
       "      <td>101106</td>\n",
       "      <td>0.740076</td>\n",
       "      <td>0.722320</td>\n",
       "      <td>0.705363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149999</th>\n",
       "      <td>0</td>\n",
       "      <td>0.850283</td>\n",
       "      <td>64</td>\n",
       "      <td>0</td>\n",
       "      <td>0.249908</td>\n",
       "      <td>8158.0</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>35145</td>\n",
       "      <td>0.201177</td>\n",
       "      <td>0.251082</td>\n",
       "      <td>0.588475</td>\n",
       "      <td>1765</td>\n",
       "      <td>31522</td>\n",
       "      <td>29757</td>\n",
       "      <td>0.176042</td>\n",
       "      <td>0.212589</td>\n",
       "      <td>0.603269</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>150000 rows × 81 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        SeriousDlqin2yrs  RevolvingUtilizationOfUnsecuredLines  age  \\\n",
       "0                      1                              0.766127   45   \n",
       "1                      0                              0.957151   40   \n",
       "2                      0                              0.658180   38   \n",
       "3                      0                              0.233810   30   \n",
       "4                      0                              0.907239   49   \n",
       "...                  ...                                   ...  ...   \n",
       "149995                 0                              0.040674   74   \n",
       "149996                 0                              0.299745   44   \n",
       "149997                 0                              0.246044   58   \n",
       "149998                 0                              0.000000   30   \n",
       "149999                 0                              0.850283   64   \n",
       "\n",
       "        NumberOfTime30-59DaysPastDueNotWorse    DebtRatio  MonthlyIncome  \\\n",
       "0                                          2     0.802982         9120.0   \n",
       "1                                          0     0.121876         2600.0   \n",
       "2                                          1     0.085113         3042.0   \n",
       "3                                          0     0.036050         3300.0   \n",
       "4                                          1     0.024926        63588.0   \n",
       "...                                      ...          ...            ...   \n",
       "149995                                     0     0.225131         2100.0   \n",
       "149996                                     0     0.716562         5584.0   \n",
       "149997                                     0  3870.000000         5400.0   \n",
       "149998                                     0     0.000000         5716.0   \n",
       "149999                                     0     0.249908         8158.0   \n",
       "\n",
       "        NumberOfOpenCreditLinesAndLoans  NumberOfTimes90DaysLate  \\\n",
       "0                                    13                        0   \n",
       "1                                     4                        0   \n",
       "2                                     2                        1   \n",
       "3                                     5                        0   \n",
       "4                                     7                        0   \n",
       "...                                 ...                      ...   \n",
       "149995                                4                        0   \n",
       "149996                                4                        0   \n",
       "149997                               18                        0   \n",
       "149998                                4                        0   \n",
       "149999                                8                        0   \n",
       "\n",
       "        NumberRealEstateLoansOrLines  NumberOfTime60-89DaysPastDueNotWorse  \\\n",
       "0                                  6                                     0   \n",
       "1                                  0                                     0   \n",
       "2                                  0                                     0   \n",
       "3                                  0                                     0   \n",
       "4                                  1                                     0   \n",
       "...                              ...                                   ...   \n",
       "149995                             1                                     0   \n",
       "149996                             1                                     0   \n",
       "149997                             1                                     0   \n",
       "149998                             0                                     0   \n",
       "149999                             2                                     0   \n",
       "\n",
       "        ...  good_bin_NumberOfOpenCreditLinesAndLoans  \\\n",
       "0       ...                                     25838   \n",
       "1       ...                                     30556   \n",
       "2       ...                                     30556   \n",
       "3       ...                                     24972   \n",
       "4       ...                                     35145   \n",
       "...     ...                                       ...   \n",
       "149995  ...                                     30556   \n",
       "149996  ...                                     30556   \n",
       "149997  ...                                     25838   \n",
       "149998  ...                                     30556   \n",
       "149999  ...                                     35145   \n",
       "\n",
       "       margin_bad_bin_NumberOfOpenCreditLinesAndLoans  \\\n",
       "0                                            0.184121   \n",
       "1                                            0.309495   \n",
       "2                                            0.309495   \n",
       "3                                            0.156892   \n",
       "4                                            0.201177   \n",
       "...                                               ...   \n",
       "149995                                       0.309495   \n",
       "149996                                       0.309495   \n",
       "149997                                       0.184121   \n",
       "149998                                       0.309495   \n",
       "149999                                       0.201177   \n",
       "\n",
       "       margin_good_bin_NumberOfOpenCreditLinesAndLoans  \\\n",
       "0                                             0.184591   \n",
       "1                                             0.218298   \n",
       "2                                             0.218298   \n",
       "3                                             0.178405   \n",
       "4                                             0.251082   \n",
       "...                                                ...   \n",
       "149995                                        0.218298   \n",
       "149996                                        0.218298   \n",
       "149997                                        0.184591   \n",
       "149998                                        0.218298   \n",
       "149999                                        0.251082   \n",
       "\n",
       "       woe_bin_NumberOfOpenCreditLinesAndLoans  \\\n",
       "0                                     0.691873   \n",
       "1                                     0.882845   \n",
       "2                                     0.882845   \n",
       "3                                     0.630962   \n",
       "4                                     0.588475   \n",
       "...                                        ...   \n",
       "149995                                0.882845   \n",
       "149996                                0.882845   \n",
       "149997                                0.691873   \n",
       "149998                                0.882845   \n",
       "149999                                0.588475   \n",
       "\n",
       "       bad_bin_NumberRealEstateLoansOrLines  \\\n",
       "0                                       841   \n",
       "1                                      7420   \n",
       "2                                      7420   \n",
       "3                                      7420   \n",
       "4                                      7420   \n",
       "...                                     ...   \n",
       "149995                                 7420   \n",
       "149996                                 7420   \n",
       "149997                                 7420   \n",
       "149998                                 7420   \n",
       "149999                                 1765   \n",
       "\n",
       "       all_bin_NumberRealEstateLoansOrLines  \\\n",
       "0                                      9952   \n",
       "1                                    108526   \n",
       "2                                    108526   \n",
       "3                                    108526   \n",
       "4                                    108526   \n",
       "...                                     ...   \n",
       "149995                               108526   \n",
       "149996                               108526   \n",
       "149997                               108526   \n",
       "149998                               108526   \n",
       "149999                                31522   \n",
       "\n",
       "       good_bin_NumberRealEstateLoansOrLines  \\\n",
       "0                                       9111   \n",
       "1                                     101106   \n",
       "2                                     101106   \n",
       "3                                     101106   \n",
       "4                                     101106   \n",
       "...                                      ...   \n",
       "149995                                101106   \n",
       "149996                                101106   \n",
       "149997                                101106   \n",
       "149998                                101106   \n",
       "149999                                 29757   \n",
       "\n",
       "       margin_bad_bin_NumberRealEstateLoansOrLines  \\\n",
       "0                                         0.083882   \n",
       "1                                         0.740076   \n",
       "2                                         0.740076   \n",
       "3                                         0.740076   \n",
       "4                                         0.740076   \n",
       "...                                            ...   \n",
       "149995                                    0.740076   \n",
       "149996                                    0.740076   \n",
       "149997                                    0.740076   \n",
       "149998                                    0.740076   \n",
       "149999                                    0.176042   \n",
       "\n",
       "       margin_good_bin_NumberRealEstateLoansOrLines  \\\n",
       "0                                          0.065091   \n",
       "1                                          0.722320   \n",
       "2                                          0.722320   \n",
       "3                                          0.722320   \n",
       "4                                          0.722320   \n",
       "...                                             ...   \n",
       "149995                                     0.722320   \n",
       "149996                                     0.722320   \n",
       "149997                                     0.722320   \n",
       "149998                                     0.722320   \n",
       "149999                                     0.212589   \n",
       "\n",
       "       woe_bin_NumberRealEstateLoansOrLines  \n",
       "0                                  0.827981  \n",
       "1                                  0.705363  \n",
       "2                                  0.705363  \n",
       "3                                  0.705363  \n",
       "4                                  0.705363  \n",
       "...                                     ...  \n",
       "149995                             0.705363  \n",
       "149996                             0.705363  \n",
       "149997                             0.705363  \n",
       "149998                             0.705363  \n",
       "149999                             0.603269  \n",
       "\n",
       "[150000 rows x 81 columns]"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#计算这些feature的woe\n",
    "def cal_WOE(df, features, target):\n",
    "    df_new = df.copy()\n",
    "    for f in features:\n",
    "        df_woe= df_new.groupby(f).agg({target:['sum','count']})\n",
    "        df_woe.columns=list(map(''.join, df_woe.columns.values))\n",
    "        df_woe.reset_index()\n",
    "        df_woe = df_woe.rename(columns={target+'sum':'bad', target+'count': 'all'})\n",
    "        #print(df_woe)\n",
    "        df_woe['good'] = df_woe['all'] - df_woe['bad']\n",
    "        df_woe['margin_bad'] = df_woe['bad']/ df_woe['bad'].sum()\n",
    "        df_woe['margin_good'] = df_woe['good']/ df_woe['good'].sum()\n",
    "        \n",
    "        #避免分母为0的情况，使用np.log1p\n",
    "        df_woe['woe'] = np.log1p(df_woe['margin_bad'] / df_woe['margin_good'])\n",
    "        \n",
    "        df_woe.columns= [c if c==f else c+'_'+f for c in list(df_woe.columns.values)]\n",
    "        \n",
    "        df_new = df_new.merge(df_woe, on=f, how='left')\n",
    "    return df_new\n",
    "df_woe = cal_WOE(df_train,bin_cols, 'SeriousDlqin2yrs')\n",
    "df_woe"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T06:58:51.707525Z",
     "start_time": "2021-01-03T06:58:51.695525Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['RevolvingUtilizationOfUnsecuredLines',\n",
       " 'NumberOfTime30-59DaysPastDueNotWorse',\n",
       " 'NumberOfTimes90DaysLate',\n",
       " 'NumberOfTime60-89DaysPastDueNotWorse',\n",
       " 'age']"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "feature_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T03:34:21.343701Z",
     "start_time": "2021-01-03T03:34:20.829671Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>feature</th>\n",
       "      <th>bin</th>\n",
       "      <th>woe</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.699, 50708.0]</td>\n",
       "      <td>1.495914</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.271, 0.699]</td>\n",
       "      <td>0.720083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.0832, 0.271]</td>\n",
       "      <td>0.350952</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(-0.001, 0.0192]</td>\n",
       "      <td>0.243890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.0192, 0.0832]</td>\n",
       "      <td>0.211221</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>1.797837</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>0.572521</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>2.151185</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>183</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>2.429111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>191</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>2.520613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>251</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>2.774776</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>423</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>2.902860</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1052</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>2.812612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6909</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>2.024184</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10822</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>2.077007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>0.608707</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>2.998746</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>186</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>2.701853</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1298</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>3.224503</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1713</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>3.379582</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1733</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>2.878935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2910</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>3.691154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3400</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>3.088387</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3929</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>4.140397</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5684</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>3.580814</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>0.645352</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>186</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>2.712133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>423</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>3.159234</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1146</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>2.955438</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1733</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>2.886833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2406</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>3.164917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6664</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>3.758483</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16642</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>2.915139</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23964</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>2.705454</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>68976</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>age</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "      <td>0.813822</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>age</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "      <td>0.955231</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>age</td>\n",
       "      <td>(70.0, inf]</td>\n",
       "      <td>0.279404</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>age</td>\n",
       "      <td>(50.0, 60.0]</td>\n",
       "      <td>0.651655</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>age</td>\n",
       "      <td>(60.0, 70.0]</td>\n",
       "      <td>0.406848</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>age</td>\n",
       "      <td>(-inf, 25.0]</td>\n",
       "      <td>1.013134</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                    feature               bin       woe\n",
       "0      RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]  1.495914\n",
       "2      RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]  0.720083\n",
       "3      RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]  0.350952\n",
       "11     RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]  0.243890\n",
       "14     RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]  0.211221\n",
       "0      NumberOfTime30-59DaysPastDueNotWorse        (1.0, 2.0]  1.797837\n",
       "1      NumberOfTime30-59DaysPastDueNotWorse       (-inf, 1.0]  0.572521\n",
       "13     NumberOfTime30-59DaysPastDueNotWorse        (2.0, 3.0]  2.151185\n",
       "183    NumberOfTime30-59DaysPastDueNotWorse        (3.0, 4.0]  2.429111\n",
       "191    NumberOfTime30-59DaysPastDueNotWorse        (4.0, 5.0]  2.520613\n",
       "251    NumberOfTime30-59DaysPastDueNotWorse        (6.0, 7.0]  2.774776\n",
       "423    NumberOfTime30-59DaysPastDueNotWorse        (9.0, inf]  2.902860\n",
       "1052   NumberOfTime30-59DaysPastDueNotWorse        (5.0, 6.0]  2.812612\n",
       "6909   NumberOfTime30-59DaysPastDueNotWorse        (7.0, 8.0]  2.024184\n",
       "10822  NumberOfTime30-59DaysPastDueNotWorse        (8.0, 9.0]  2.077007\n",
       "0                   NumberOfTimes90DaysLate       (-inf, 1.0]  0.608707\n",
       "13                  NumberOfTimes90DaysLate        (2.0, 3.0]  2.998746\n",
       "186                 NumberOfTimes90DaysLate        (1.0, 2.0]  2.701853\n",
       "1298                NumberOfTimes90DaysLate        (4.0, 5.0]  3.224503\n",
       "1713                NumberOfTimes90DaysLate        (3.0, 4.0]  3.379582\n",
       "1733                NumberOfTimes90DaysLate        (9.0, inf]  2.878935\n",
       "2910                NumberOfTimes90DaysLate        (8.0, 9.0]  3.691154\n",
       "3400                NumberOfTimes90DaysLate        (5.0, 6.0]  3.088387\n",
       "3929                NumberOfTimes90DaysLate        (6.0, 7.0]  4.140397\n",
       "5684                NumberOfTimes90DaysLate        (7.0, 8.0]  3.580814\n",
       "0      NumberOfTime60-89DaysPastDueNotWorse       (-inf, 1.0]  0.645352\n",
       "186    NumberOfTime60-89DaysPastDueNotWorse        (1.0, 2.0]  2.712133\n",
       "423    NumberOfTime60-89DaysPastDueNotWorse        (4.0, 5.0]  3.159234\n",
       "1146   NumberOfTime60-89DaysPastDueNotWorse        (2.0, 3.0]  2.955438\n",
       "1733   NumberOfTime60-89DaysPastDueNotWorse        (9.0, inf]  2.886833\n",
       "2406   NumberOfTime60-89DaysPastDueNotWorse        (3.0, 4.0]  3.164917\n",
       "6664   NumberOfTime60-89DaysPastDueNotWorse        (5.0, 6.0]  3.758483\n",
       "16642  NumberOfTime60-89DaysPastDueNotWorse        (6.0, 7.0]  2.915139\n",
       "23964  NumberOfTime60-89DaysPastDueNotWorse        (7.0, 8.0]  2.705454\n",
       "68976  NumberOfTime60-89DaysPastDueNotWorse        (8.0, 9.0]  0.000000\n",
       "0                                       age      (40.0, 50.0]  0.813822\n",
       "1                                       age      (25.0, 40.0]  0.955231\n",
       "5                                       age       (70.0, inf]  0.279404\n",
       "6                                       age      (50.0, 60.0]  0.651655\n",
       "15                                      age      (60.0, 70.0]  0.406848\n",
       "19                                      age      (-inf, 25.0]  1.013134"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#得到woe的规则\n",
    "df_bin_to_woe= pd.DataFrame(columns=['feature','bin','woe'])\n",
    "for f in feature_cols:\n",
    "    b = 'bin_'+f\n",
    "    w = 'woe_bin_'+f\n",
    "    df= df_woe[[w,b]].drop_duplicates()\n",
    "    df.columns=['woe','bin']\n",
    "    #print(df)\n",
    "    df['feature']=f\n",
    "    df_bin_to_woe = pd.concat([df_bin_to_woe,df])\n",
    "    \n",
    "df_bin_to_woe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-12-13T06:57:11.326660Z",
     "start_time": "2020-12-13T06:57:11.318660Z"
    }
   },
   "source": [
    "## 逻辑回归建模"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T08:26:55.684751Z",
     "start_time": "2021-01-03T08:26:55.671751Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['woe_bin_age',\n",
       " 'woe_bin_NumberOfTime30-59DaysPastDueNotWorse',\n",
       " 'woe_bin_NumberOfTime60-89DaysPastDueNotWorse',\n",
       " 'woe_bin_NumberOfTimes90DaysLate',\n",
       " 'woe_bin_RevolvingUtilizationOfUnsecuredLines']"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "woe_cols = [c for c in list(df_woe.columns.values) if 'woe' in c and c[8:] in feature_cols]\n",
    "woe_cols"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T08:27:50.283874Z",
     "start_time": "2021-01-03T08:27:49.971856Z"
    }
   },
   "outputs": [],
   "source": [
    "#数据集切分\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "x_train,x_test, y_train, y_test = train_test_split(df_woe[woe_cols],df_woe['SeriousDlqin2yrs'], test_size=0.2, random_state=30)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T08:30:24.588700Z",
     "start_time": "2021-01-03T08:30:23.954664Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.9381\n",
      "0.7909349558526235\n"
     ]
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegression\n",
    "from sklearn.metrics import accuracy_score,roc_auc_score\n",
    "\n",
    "model= LogisticRegression(random_state=33).fit(x_train,y_train)\n",
    "y_pred = model.predict(x_test)\n",
    "\n",
    "print(accuracy_score(y_pred, y_test))\n",
    "print(roc_auc_score(y_pred, y_test))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 评分卡模型转换\n",
    "设p为客户违约的概率，那么正常的概率为1-p\n",
    " $$Odds =\\frac{p}{1-p}$$ \n",
    " 客户违约概率p可以表示\n",
    " $$p=\\frac{Odds}{1+Odds}$$\n",
    " 评分卡的分值计算，可以通过分值表示为比率对数的线性表达式来定义，即\n",
    " $$Score=A - B * ln(Odds)$$\n",
    " $$Score = A - B\\{\\theta_0 + \\theta_1x_1 + \\theta_2x_2 + ... + \\theta_nx_n\\}$$\n",
    " Score计算公式类似 y=kx + b ，A和B是常数，A称为“补偿”，B称为“刻度”，公式中的负号可以使得违约概率越低，得分越高\n",
    " \n",
    " $$B=\\frac{PDO}{ln2}$$\n",
    " $$A=P_{0} + B*ln(\\theta_0) $$\n",
    " 给某个特定的比率$\\theta_0$时，预期的分值为$P_{0}$  \n",
    " PDO（ point of double odds ），即比率翻倍的分数;比如，odds翻倍时，分值减少50\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "逻辑回归：$p=\\frac{1}{1+e^{-Q^Tx}}$,将公式变化下可得  \n",
    "$ln(\\frac{p}{1-p})=Q^Tx$,即$ln(odds)=Q^Tx$  \n",
    "所以，Odds可以和逻辑回归无缝结合\n",
    "评分卡的逻辑是Odds的变动与评分变动的映射，即把Odds映射为评分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T08:53:14.906078Z",
     "start_time": "2021-01-03T08:53:14.797072Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Variable</th>\n",
       "      <th>Binning</th>\n",
       "      <th>Score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.699, 50708.0]</td>\n",
       "      <td>-114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.271, 0.699]</td>\n",
       "      <td>-55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.0832, 0.271]</td>\n",
       "      <td>-27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(-0.001, 0.0192]</td>\n",
       "      <td>-19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.0192, 0.0832]</td>\n",
       "      <td>-16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>-114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>-36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>-136</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>-154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>-160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>-176</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>-184</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>-178</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>-128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>-132</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>-18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>-91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>-82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>-97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>-102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>-87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>-112</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>-93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>-125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>-108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>-33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>-139</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>-161</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>-151</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>-147</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>-162</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>-192</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>-149</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>-138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>age</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "      <td>-85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>age</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "      <td>-99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>age</td>\n",
       "      <td>(70.0, inf]</td>\n",
       "      <td>-29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>age</td>\n",
       "      <td>(50.0, 60.0]</td>\n",
       "      <td>-68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>age</td>\n",
       "      <td>(60.0, 70.0]</td>\n",
       "      <td>-42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>age</td>\n",
       "      <td>(-inf, 25.0]</td>\n",
       "      <td>-105</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                Variable           Binning  Score\n",
       "0   RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
       "1   RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
       "2   RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
       "3   RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
       "4   RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
       "5   NumberOfTime30-59DaysPastDueNotWorse        (1.0, 2.0]   -114\n",
       "6   NumberOfTime30-59DaysPastDueNotWorse       (-inf, 1.0]    -36\n",
       "7   NumberOfTime30-59DaysPastDueNotWorse        (2.0, 3.0]   -136\n",
       "8   NumberOfTime30-59DaysPastDueNotWorse        (3.0, 4.0]   -154\n",
       "9   NumberOfTime30-59DaysPastDueNotWorse        (4.0, 5.0]   -160\n",
       "10  NumberOfTime30-59DaysPastDueNotWorse        (6.0, 7.0]   -176\n",
       "11  NumberOfTime30-59DaysPastDueNotWorse        (9.0, inf]   -184\n",
       "12  NumberOfTime30-59DaysPastDueNotWorse        (5.0, 6.0]   -178\n",
       "13  NumberOfTime30-59DaysPastDueNotWorse        (7.0, 8.0]   -128\n",
       "14  NumberOfTime30-59DaysPastDueNotWorse        (8.0, 9.0]   -132\n",
       "15               NumberOfTimes90DaysLate       (-inf, 1.0]    -18\n",
       "16               NumberOfTimes90DaysLate        (2.0, 3.0]    -91\n",
       "17               NumberOfTimes90DaysLate        (1.0, 2.0]    -82\n",
       "18               NumberOfTimes90DaysLate        (4.0, 5.0]    -97\n",
       "19               NumberOfTimes90DaysLate        (3.0, 4.0]   -102\n",
       "20               NumberOfTimes90DaysLate        (9.0, inf]    -87\n",
       "21               NumberOfTimes90DaysLate        (8.0, 9.0]   -112\n",
       "22               NumberOfTimes90DaysLate        (5.0, 6.0]    -93\n",
       "23               NumberOfTimes90DaysLate        (6.0, 7.0]   -125\n",
       "24               NumberOfTimes90DaysLate        (7.0, 8.0]   -108\n",
       "25  NumberOfTime60-89DaysPastDueNotWorse       (-inf, 1.0]    -33\n",
       "26  NumberOfTime60-89DaysPastDueNotWorse        (1.0, 2.0]   -139\n",
       "27  NumberOfTime60-89DaysPastDueNotWorse        (4.0, 5.0]   -161\n",
       "28  NumberOfTime60-89DaysPastDueNotWorse        (2.0, 3.0]   -151\n",
       "29  NumberOfTime60-89DaysPastDueNotWorse        (9.0, inf]   -147\n",
       "30  NumberOfTime60-89DaysPastDueNotWorse        (3.0, 4.0]   -162\n",
       "31  NumberOfTime60-89DaysPastDueNotWorse        (5.0, 6.0]   -192\n",
       "32  NumberOfTime60-89DaysPastDueNotWorse        (6.0, 7.0]   -149\n",
       "33  NumberOfTime60-89DaysPastDueNotWorse        (7.0, 8.0]   -138\n",
       "34  NumberOfTime60-89DaysPastDueNotWorse        (8.0, 9.0]      0\n",
       "35                                   age      (40.0, 50.0]    -85\n",
       "36                                   age      (25.0, 40.0]    -99\n",
       "37                                   age       (70.0, inf]    -29\n",
       "38                                   age      (50.0, 60.0]    -68\n",
       "39                                   age      (60.0, 70.0]    -42\n",
       "40                                   age      (-inf, 25.0]   -105"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#PDO = 50,B=72.13    (B = PDO/ln2 = 50/ln2 = 72.13)\n",
    "#Odds=1的时候，分数为650  -> A=650\n",
    "A,B = 650, 72.13\n",
    "\n",
    "#生成评分卡模型\n",
    "def generate_scorecard(model_coef, binning_df, features, B):\n",
    "    lst = []\n",
    "    cols = ['Variable', 'Binning', 'Score']\n",
    "    #模型参数\n",
    "    coef = model_coef[0]\n",
    "    #print(coef)\n",
    "    \n",
    "    for i in range(len(features)):\n",
    "        f =features[i]\n",
    "        #得到这个feature的woe\n",
    "        df = binning_df[binning_df['feature']==f]\n",
    "        for index,row in df.iterrows():\n",
    "            #参考上面的公式，coef[i]对应theta{i}，x就是woe，模型的x就是经过woe编码\n",
    "            score = int(round(-coef[i] * row['woe'] * B))\n",
    "            lst.append([f, row['bin'], score])\n",
    "    data = pd.DataFrame(lst, columns=cols)\n",
    "    \n",
    "    return data\n",
    "\n",
    "#df_bin_to_woe:每个feature每个bin的woe\n",
    "score_card = generate_scorecard(model.coef_, df_bin_to_woe, feature_cols, B)\n",
    "score_card"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T09:37:27.505798Z",
     "start_time": "2021-01-03T09:37:27.390791Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Variable</th>\n",
       "      <th>Binning</th>\n",
       "      <th>Score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.699, 50708.0]</td>\n",
       "      <td>-114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.271, 0.699]</td>\n",
       "      <td>-55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.0832, 0.271]</td>\n",
       "      <td>-27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(-0.001, 0.0192]</td>\n",
       "      <td>-19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>RevolvingUtilizationOfUnsecuredLines</td>\n",
       "      <td>(0.0192, 0.0832]</td>\n",
       "      <td>-16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>-114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>-36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>-136</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>-154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>-160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>-176</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>-184</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>-178</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>-128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>NumberOfTime30-59DaysPastDueNotWorse</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>-132</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>-18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>-91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>-82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>-97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>-102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>-87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>-112</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>-93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>-125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>NumberOfTimes90DaysLate</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>-108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(-inf, 1.0]</td>\n",
       "      <td>-33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(1.0, 2.0]</td>\n",
       "      <td>-139</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(4.0, 5.0]</td>\n",
       "      <td>-161</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(2.0, 3.0]</td>\n",
       "      <td>-151</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(9.0, inf]</td>\n",
       "      <td>-147</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(3.0, 4.0]</td>\n",
       "      <td>-162</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(5.0, 6.0]</td>\n",
       "      <td>-192</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(6.0, 7.0]</td>\n",
       "      <td>-149</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(7.0, 8.0]</td>\n",
       "      <td>-138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>NumberOfTime60-89DaysPastDueNotWorse</td>\n",
       "      <td>(8.0, 9.0]</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>age</td>\n",
       "      <td>(40.0, 50.0]</td>\n",
       "      <td>-85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>age</td>\n",
       "      <td>(25.0, 40.0]</td>\n",
       "      <td>-99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>age</td>\n",
       "      <td>(70.0, inf]</td>\n",
       "      <td>-29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>age</td>\n",
       "      <td>(50.0, 60.0]</td>\n",
       "      <td>-68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>age</td>\n",
       "      <td>(60.0, 70.0]</td>\n",
       "      <td>-42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>age</td>\n",
       "      <td>(-inf, 25.0]</td>\n",
       "      <td>-105</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                Variable           Binning  Score\n",
       "0   RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
       "1   RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
       "2   RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
       "3   RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
       "4   RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
       "5   NumberOfTime30-59DaysPastDueNotWorse        (1.0, 2.0]   -114\n",
       "6   NumberOfTime30-59DaysPastDueNotWorse       (-inf, 1.0]    -36\n",
       "7   NumberOfTime30-59DaysPastDueNotWorse        (2.0, 3.0]   -136\n",
       "8   NumberOfTime30-59DaysPastDueNotWorse        (3.0, 4.0]   -154\n",
       "9   NumberOfTime30-59DaysPastDueNotWorse        (4.0, 5.0]   -160\n",
       "10  NumberOfTime30-59DaysPastDueNotWorse        (6.0, 7.0]   -176\n",
       "11  NumberOfTime30-59DaysPastDueNotWorse        (9.0, inf]   -184\n",
       "12  NumberOfTime30-59DaysPastDueNotWorse        (5.0, 6.0]   -178\n",
       "13  NumberOfTime30-59DaysPastDueNotWorse        (7.0, 8.0]   -128\n",
       "14  NumberOfTime30-59DaysPastDueNotWorse        (8.0, 9.0]   -132\n",
       "15               NumberOfTimes90DaysLate       (-inf, 1.0]    -18\n",
       "16               NumberOfTimes90DaysLate        (2.0, 3.0]    -91\n",
       "17               NumberOfTimes90DaysLate        (1.0, 2.0]    -82\n",
       "18               NumberOfTimes90DaysLate        (4.0, 5.0]    -97\n",
       "19               NumberOfTimes90DaysLate        (3.0, 4.0]   -102\n",
       "20               NumberOfTimes90DaysLate        (9.0, inf]    -87\n",
       "21               NumberOfTimes90DaysLate        (8.0, 9.0]   -112\n",
       "22               NumberOfTimes90DaysLate        (5.0, 6.0]    -93\n",
       "23               NumberOfTimes90DaysLate        (6.0, 7.0]   -125\n",
       "24               NumberOfTimes90DaysLate        (7.0, 8.0]   -108\n",
       "25  NumberOfTime60-89DaysPastDueNotWorse       (-inf, 1.0]    -33\n",
       "26  NumberOfTime60-89DaysPastDueNotWorse        (1.0, 2.0]   -139\n",
       "27  NumberOfTime60-89DaysPastDueNotWorse        (4.0, 5.0]   -161\n",
       "28  NumberOfTime60-89DaysPastDueNotWorse        (2.0, 3.0]   -151\n",
       "29  NumberOfTime60-89DaysPastDueNotWorse        (9.0, inf]   -147\n",
       "30  NumberOfTime60-89DaysPastDueNotWorse        (3.0, 4.0]   -162\n",
       "31  NumberOfTime60-89DaysPastDueNotWorse        (5.0, 6.0]   -192\n",
       "32  NumberOfTime60-89DaysPastDueNotWorse        (6.0, 7.0]   -149\n",
       "33  NumberOfTime60-89DaysPastDueNotWorse        (7.0, 8.0]   -138\n",
       "34  NumberOfTime60-89DaysPastDueNotWorse        (8.0, 9.0]      0\n",
       "35                                   age      (40.0, 50.0]    -85\n",
       "36                                   age      (25.0, 40.0]    -99\n",
       "37                                   age       (70.0, inf]    -29\n",
       "38                                   age      (50.0, 60.0]    -68\n",
       "39                                   age      (60.0, 70.0]    -42\n",
       "40                                   age      (-inf, 25.0]   -105"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#对每个字段按照分数降序进行排序，查看规则\n",
    "score_card.groupby('Variable').apply(lambda x:x.sort_values('Score', ascending=False))\n",
    "score_card"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 用户的评分卡分数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T10:53:59.933470Z",
     "start_time": "2021-01-03T10:53:59.901468Z"
    }
   },
   "outputs": [],
   "source": [
    "#将字符转换为数值型\n",
    "def str_to_int(s):\n",
    "    if s == '-inf':\n",
    "        return -999999\n",
    "    if s == 'inf':\n",
    "        return 999999\n",
    "    \n",
    "    return float(s)\n",
    "\n",
    "\n",
    "#将value映射到bin\n",
    "def map_value_to_bin(feature_value, feature_to_bin):\n",
    "    for index, row in feature_to_bin.iterrows():\n",
    "        bins = str(row['Binning'])\n",
    "        left_open = bins[0] == '('\n",
    "        right_open = bins[-1] == ')'  #如果右侧为],right_open=0\n",
    "        \n",
    "        binnings = bins[1:-1].split(',')\n",
    "        in_range = True\n",
    "\n",
    "        #检查左括号\n",
    "        if left_open:\n",
    "            if feature_value <= str_to_int(binnings[0]):\n",
    "                in_range = False\n",
    "        else:\n",
    "            if feature_value < str_to_int(binnings[0]):\n",
    "                in_range = False\n",
    "        \n",
    "        #检查右括号\n",
    "        if right_open: #)\n",
    "            if feature_value >= str_to_int(binnings[1]):\n",
    "                in_range = False\n",
    "        else:  #]\n",
    "            if feature_value > str_to_int(binnings[1]):\n",
    "                in_range = False\n",
    "        if in_range:\n",
    "            return row['Binning']\n",
    "        \n",
    "    print(f'not found {feature_value}')\n",
    "    return None\n",
    "#通过评分卡规则score_card转换为分数\n",
    "def map_to_score(df, score_card):\n",
    "    scored_columns = list(score_card['Variable'].unique())\n",
    "\n",
    "    score = 0\n",
    "    \n",
    "    for col in scored_columns:\n",
    "        #某个特征的所有bins\n",
    "        feature_to_bin = score_card[score_card['Variable'] == col]\n",
    "        \n",
    "        #该样本的对应特征的取值\n",
    "        feature_value = df[col]\n",
    "        \n",
    "        print(feature_to_bin)\n",
    "        print(feature_value)\n",
    "        #该样本对应特征的value映射到bin\n",
    "        selected_bin = map_value_to_bin(feature_value, feature_to_bin)\n",
    "        \n",
    "        #对应bin的score取出来，并把该样本所有特征的score进行累加，就是该样本(该人)的得分\n",
    "        selected_record_in_scorecard = feature_to_bin[feature_to_bin['Binning']==selected_bin]\n",
    "        score= score+selected_record_in_scorecard['Score'].iloc[0]\n",
    "    return score\n",
    "\n",
    "#使用评分卡模型计算分数\n",
    "def calculate_score_with_card(df, score_card, A):\n",
    "    df['score'] = df.apply(map_to_score, args=(score_card,), axis=1)\n",
    "    \n",
    "    #加上基本分，最后就是总的得分\n",
    "    df['score'] += A\n",
    "    \n",
    "    #得分转换成整数类型\n",
    "    df['score'] = df['score'].astype(int)\n",
    "    return df\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T10:54:05.169769Z",
     "start_time": "2021-01-03T10:54:01.868580Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.002942773\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "46.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.313609242\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "1.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "52.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "53.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.311474044\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "56.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.18697487399999999\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "44.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.767392029\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "28.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.046860224000000006\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "68.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.005005082\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "58.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.423576424\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "36.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.647424464\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "49.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.416289714\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "49.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.929649155\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "3.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "2.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "2.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "43.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.134927759\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "49.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "1.02767363\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "4.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "1.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "27.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.042312909\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "35.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.054911897\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "42.0\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.295483787\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "51.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.029373512999999997\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "1.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "68.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.970166311\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "41.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.436420598\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "82.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.026999471\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "51.0\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.029496502\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "45.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.610452394\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "32.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.016444112\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "58.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.9500997999999999\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "29.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.8662377240000001\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "54.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.698976723\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "35.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.038838446\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "84.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.081981815\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "65.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.8355717659999999\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "5.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "44.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.219746676\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "77.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.30637849100000003\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "52.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "71.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.335116663\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "2.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "67.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.027884014\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "54.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.0127182\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "64.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.579772046\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "42.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.046122967\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "38.0\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.9999998999999999\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "58.0\n",
      "                               Variable           Binning  Score\n",
      "0  RevolvingUtilizationOfUnsecuredLines  (0.699, 50708.0]   -114\n",
      "1  RevolvingUtilizationOfUnsecuredLines    (0.271, 0.699]    -55\n",
      "2  RevolvingUtilizationOfUnsecuredLines   (0.0832, 0.271]    -27\n",
      "3  RevolvingUtilizationOfUnsecuredLines  (-0.001, 0.0192]    -19\n",
      "4  RevolvingUtilizationOfUnsecuredLines  (0.0192, 0.0832]    -16\n",
      "0.092967429\n",
      "                                Variable      Binning  Score\n",
      "5   NumberOfTime30-59DaysPastDueNotWorse   (1.0, 2.0]   -114\n",
      "6   NumberOfTime30-59DaysPastDueNotWorse  (-inf, 1.0]    -36\n",
      "7   NumberOfTime30-59DaysPastDueNotWorse   (2.0, 3.0]   -136\n",
      "8   NumberOfTime30-59DaysPastDueNotWorse   (3.0, 4.0]   -154\n",
      "9   NumberOfTime30-59DaysPastDueNotWorse   (4.0, 5.0]   -160\n",
      "10  NumberOfTime30-59DaysPastDueNotWorse   (6.0, 7.0]   -176\n",
      "11  NumberOfTime30-59DaysPastDueNotWorse   (9.0, inf]   -184\n",
      "12  NumberOfTime30-59DaysPastDueNotWorse   (5.0, 6.0]   -178\n",
      "13  NumberOfTime30-59DaysPastDueNotWorse   (7.0, 8.0]   -128\n",
      "14  NumberOfTime30-59DaysPastDueNotWorse   (8.0, 9.0]   -132\n",
      "0.0\n",
      "                   Variable      Binning  Score\n",
      "15  NumberOfTimes90DaysLate  (-inf, 1.0]    -18\n",
      "16  NumberOfTimes90DaysLate   (2.0, 3.0]    -91\n",
      "17  NumberOfTimes90DaysLate   (1.0, 2.0]    -82\n",
      "18  NumberOfTimes90DaysLate   (4.0, 5.0]    -97\n",
      "19  NumberOfTimes90DaysLate   (3.0, 4.0]   -102\n",
      "20  NumberOfTimes90DaysLate   (9.0, inf]    -87\n",
      "21  NumberOfTimes90DaysLate   (8.0, 9.0]   -112\n",
      "22  NumberOfTimes90DaysLate   (5.0, 6.0]    -93\n",
      "23  NumberOfTimes90DaysLate   (6.0, 7.0]   -125\n",
      "24  NumberOfTimes90DaysLate   (7.0, 8.0]   -108\n",
      "0.0\n",
      "                                Variable      Binning  Score\n",
      "25  NumberOfTime60-89DaysPastDueNotWorse  (-inf, 1.0]    -33\n",
      "26  NumberOfTime60-89DaysPastDueNotWorse   (1.0, 2.0]   -139\n",
      "27  NumberOfTime60-89DaysPastDueNotWorse   (4.0, 5.0]   -161\n",
      "28  NumberOfTime60-89DaysPastDueNotWorse   (2.0, 3.0]   -151\n",
      "29  NumberOfTime60-89DaysPastDueNotWorse   (9.0, inf]   -147\n",
      "30  NumberOfTime60-89DaysPastDueNotWorse   (3.0, 4.0]   -162\n",
      "31  NumberOfTime60-89DaysPastDueNotWorse   (5.0, 6.0]   -192\n",
      "32  NumberOfTime60-89DaysPastDueNotWorse   (6.0, 7.0]   -149\n",
      "33  NumberOfTime60-89DaysPastDueNotWorse   (7.0, 8.0]   -138\n",
      "34  NumberOfTime60-89DaysPastDueNotWorse   (8.0, 9.0]      0\n",
      "0.0\n",
      "   Variable       Binning  Score\n",
      "35      age  (40.0, 50.0]    -85\n",
      "36      age  (25.0, 40.0]    -99\n",
      "37      age   (70.0, inf]    -29\n",
      "38      age  (50.0, 60.0]    -68\n",
      "39      age  (60.0, 70.0]    -42\n",
      "40      age  (-inf, 25.0]   -105\n",
      "86.0\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RevolvingUtilizationOfUnsecuredLines</th>\n",
       "      <th>NumberOfTime30-59DaysPastDueNotWorse</th>\n",
       "      <th>NumberOfTimes90DaysLate</th>\n",
       "      <th>NumberOfTime60-89DaysPastDueNotWorse</th>\n",
       "      <th>age</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>140226</th>\n",
       "      <td>0.002943</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>46</td>\n",
       "      <td>459</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130212</th>\n",
       "      <td>0.313609</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13846</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>53</td>\n",
       "      <td>476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>138847</th>\n",
       "      <td>0.311474</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>56</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93054</th>\n",
       "      <td>0.186975</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>44</td>\n",
       "      <td>451</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130801</th>\n",
       "      <td>0.767392</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>28</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>65925</th>\n",
       "      <td>0.046860</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>68</td>\n",
       "      <td>505</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>129489</th>\n",
       "      <td>0.005005</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>58</td>\n",
       "      <td>476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149169</th>\n",
       "      <td>0.423576</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>36</td>\n",
       "      <td>409</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103194</th>\n",
       "      <td>0.647424</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>49</td>\n",
       "      <td>423</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30227</th>\n",
       "      <td>0.416290</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>49</td>\n",
       "      <td>423</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100877</th>\n",
       "      <td>0.929649</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>43</td>\n",
       "      <td>94</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87237</th>\n",
       "      <td>0.134928</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>49</td>\n",
       "      <td>451</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79028</th>\n",
       "      <td>1.027674</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>27</td>\n",
       "      <td>232</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2092</th>\n",
       "      <td>0.042313</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35</td>\n",
       "      <td>448</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98578</th>\n",
       "      <td>0.054912</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>42</td>\n",
       "      <td>462</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14537</th>\n",
       "      <td>0.295484</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>51</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126204</th>\n",
       "      <td>0.029374</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>68</td>\n",
       "      <td>505</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10735</th>\n",
       "      <td>0.970166</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>41</td>\n",
       "      <td>364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73928</th>\n",
       "      <td>0.436421</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>82</td>\n",
       "      <td>479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91102</th>\n",
       "      <td>0.026999</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>51</td>\n",
       "      <td>479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53141</th>\n",
       "      <td>0.029497</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>45</td>\n",
       "      <td>462</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6376</th>\n",
       "      <td>0.610452</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>32</td>\n",
       "      <td>409</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98024</th>\n",
       "      <td>0.016444</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>58</td>\n",
       "      <td>476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>65744</th>\n",
       "      <td>0.950100</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>29</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8014</th>\n",
       "      <td>0.866238</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>54</td>\n",
       "      <td>381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>66664</th>\n",
       "      <td>0.698977</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35</td>\n",
       "      <td>409</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99171</th>\n",
       "      <td>0.038838</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>84</td>\n",
       "      <td>518</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71692</th>\n",
       "      <td>0.081982</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>65</td>\n",
       "      <td>505</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13584</th>\n",
       "      <td>0.835572</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>44</td>\n",
       "      <td>240</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31472</th>\n",
       "      <td>0.219747</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>77</td>\n",
       "      <td>507</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110142</th>\n",
       "      <td>0.306378</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110007</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>71</td>\n",
       "      <td>515</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29305</th>\n",
       "      <td>0.335117</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>67</td>\n",
       "      <td>388</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126609</th>\n",
       "      <td>0.027884</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>54</td>\n",
       "      <td>479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62173</th>\n",
       "      <td>0.012718</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>64</td>\n",
       "      <td>502</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78021</th>\n",
       "      <td>0.579772</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>42</td>\n",
       "      <td>423</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>105891</th>\n",
       "      <td>0.046123</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38</td>\n",
       "      <td>448</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>106062</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>58</td>\n",
       "      <td>381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>143128</th>\n",
       "      <td>0.092967</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>86</td>\n",
       "      <td>507</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        RevolvingUtilizationOfUnsecuredLines  \\\n",
       "140226                              0.002943   \n",
       "130212                              0.313609   \n",
       "13846                               0.000000   \n",
       "138847                              0.311474   \n",
       "93054                               0.186975   \n",
       "130801                              0.767392   \n",
       "65925                               0.046860   \n",
       "129489                              0.005005   \n",
       "149169                              0.423576   \n",
       "103194                              0.647424   \n",
       "30227                               0.416290   \n",
       "100877                              0.929649   \n",
       "87237                               0.134928   \n",
       "79028                               1.027674   \n",
       "2092                                0.042313   \n",
       "98578                               0.054912   \n",
       "14537                               0.295484   \n",
       "126204                              0.029374   \n",
       "10735                               0.970166   \n",
       "73928                               0.436421   \n",
       "91102                               0.026999   \n",
       "53141                               0.029497   \n",
       "6376                                0.610452   \n",
       "98024                               0.016444   \n",
       "65744                               0.950100   \n",
       "8014                                0.866238   \n",
       "66664                               0.698977   \n",
       "99171                               0.038838   \n",
       "71692                               0.081982   \n",
       "13584                               0.835572   \n",
       "31472                               0.219747   \n",
       "110142                              0.306378   \n",
       "110007                              0.000000   \n",
       "29305                               0.335117   \n",
       "126609                              0.027884   \n",
       "62173                               0.012718   \n",
       "78021                               0.579772   \n",
       "105891                              0.046123   \n",
       "106062                              1.000000   \n",
       "143128                              0.092967   \n",
       "\n",
       "        NumberOfTime30-59DaysPastDueNotWorse  NumberOfTimes90DaysLate  \\\n",
       "140226                                     0                        0   \n",
       "130212                                     1                        0   \n",
       "13846                                      0                        0   \n",
       "138847                                     0                        0   \n",
       "93054                                      0                        0   \n",
       "130801                                     0                        0   \n",
       "65925                                      0                        0   \n",
       "129489                                     0                        0   \n",
       "149169                                     0                        0   \n",
       "103194                                     0                        0   \n",
       "30227                                      0                        0   \n",
       "100877                                     3                        2   \n",
       "87237                                      0                        0   \n",
       "79028                                      4                        1   \n",
       "2092                                       0                        0   \n",
       "98578                                      0                        0   \n",
       "14537                                      0                        0   \n",
       "126204                                     1                        0   \n",
       "10735                                      0                        0   \n",
       "73928                                      0                        0   \n",
       "91102                                      0                        0   \n",
       "53141                                      0                        0   \n",
       "6376                                       0                        0   \n",
       "98024                                      0                        0   \n",
       "65744                                      0                        0   \n",
       "8014                                       0                        0   \n",
       "66664                                      0                        0   \n",
       "99171                                      0                        0   \n",
       "71692                                      0                        0   \n",
       "13584                                      5                        0   \n",
       "31472                                      0                        0   \n",
       "110142                                     0                        0   \n",
       "110007                                     0                        0   \n",
       "29305                                      2                        0   \n",
       "126609                                     0                        0   \n",
       "62173                                      0                        0   \n",
       "78021                                      0                        0   \n",
       "105891                                     0                        0   \n",
       "106062                                     0                        0   \n",
       "143128                                     0                        0   \n",
       "\n",
       "        NumberOfTime60-89DaysPastDueNotWorse  age  score  \n",
       "140226                                     0   46    459  \n",
       "130212                                     0   52    440  \n",
       "13846                                      0   53    476  \n",
       "138847                                     0   56    440  \n",
       "93054                                      0   44    451  \n",
       "130801                                     0   28    350  \n",
       "65925                                      0   68    505  \n",
       "129489                                     0   58    476  \n",
       "149169                                     0   36    409  \n",
       "103194                                     0   49    423  \n",
       "30227                                      0   49    423  \n",
       "100877                                     2   43     94  \n",
       "87237                                      0   49    451  \n",
       "79028                                      0   27    232  \n",
       "2092                                       0   35    448  \n",
       "98578                                      0   42    462  \n",
       "14537                                      0   51    440  \n",
       "126204                                     0   68    505  \n",
       "10735                                      0   41    364  \n",
       "73928                                      0   82    479  \n",
       "91102                                      0   51    479  \n",
       "53141                                      0   45    462  \n",
       "6376                                       0   32    409  \n",
       "98024                                      0   58    476  \n",
       "65744                                      0   29    350  \n",
       "8014                                       0   54    381  \n",
       "66664                                      0   35    409  \n",
       "99171                                      0   84    518  \n",
       "71692                                      0   65    505  \n",
       "13584                                      0   44    240  \n",
       "31472                                      0   77    507  \n",
       "110142                                     0   52    440  \n",
       "110007                                     0   71    515  \n",
       "29305                                      0   67    388  \n",
       "126609                                     0   54    479  \n",
       "62173                                      0   64    502  \n",
       "78021                                      0   42    423  \n",
       "105891                                     0   38    448  \n",
       "106062                                     0   58    381  \n",
       "143128                                     0   86    507  "
      ]
     },
     "execution_count": 156,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#随机选择Good的5个人\n",
    "good_sample = df_train[df_train['SeriousDlqin2yrs']==0].sample(40)\n",
    "good_sample = good_sample[feature_cols]\n",
    "#应用评分卡对sample计算分数\n",
    "calculate_score_with_card(good_sample, score_card, A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-03T10:46:50.695919Z",
     "start_time": "2021-01-03T10:46:48.935818Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RevolvingUtilizationOfUnsecuredLines</th>\n",
       "      <th>NumberOfTime30-59DaysPastDueNotWorse</th>\n",
       "      <th>NumberOfTimes90DaysLate</th>\n",
       "      <th>NumberOfTime60-89DaysPastDueNotWorse</th>\n",
       "      <th>age</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>58539</th>\n",
       "      <td>0.862907</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>42</td>\n",
       "      <td>107</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74528</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>23</td>\n",
       "      <td>344</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130362</th>\n",
       "      <td>0.729272</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>51</td>\n",
       "      <td>281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>105896</th>\n",
       "      <td>0.527449</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>37</td>\n",
       "      <td>409</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73233</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>47</td>\n",
       "      <td>364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>83213</th>\n",
       "      <td>0.976681</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>35</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17958</th>\n",
       "      <td>0.194393</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>41</td>\n",
       "      <td>451</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41647</th>\n",
       "      <td>1.031697</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>39</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50991</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>58</td>\n",
       "      <td>199</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17568</th>\n",
       "      <td>0.747607</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>47</td>\n",
       "      <td>300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19179</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>98</td>\n",
       "      <td>98</td>\n",
       "      <td>98</td>\n",
       "      <td>21</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>147420</th>\n",
       "      <td>1.093977</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>29</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85568</th>\n",
       "      <td>1.017013</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>56</td>\n",
       "      <td>113</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77641</th>\n",
       "      <td>0.974565</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>57</td>\n",
       "      <td>381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>148684</th>\n",
       "      <td>0.950171</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>62</td>\n",
       "      <td>201</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90532</th>\n",
       "      <td>0.398879</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>46</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96038</th>\n",
       "      <td>0.601903</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>73</td>\n",
       "      <td>479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60449</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38</td>\n",
       "      <td>272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98361</th>\n",
       "      <td>0.941550</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>53</td>\n",
       "      <td>381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>768</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>32</td>\n",
       "      <td>445</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9712</th>\n",
       "      <td>0.138934</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>468</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67678</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>53</td>\n",
       "      <td>358</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41673</th>\n",
       "      <td>0.016081</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>59</td>\n",
       "      <td>358</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>109760</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>59</td>\n",
       "      <td>317</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59063</th>\n",
       "      <td>0.736396</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>39</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126493</th>\n",
       "      <td>0.379510</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38</td>\n",
       "      <td>331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126335</th>\n",
       "      <td>1.047904</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>61</td>\n",
       "      <td>329</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21558</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>27</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42445</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>28</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>423</th>\n",
       "      <td>0.991502</td>\n",
       "      <td>10</td>\n",
       "      <td>2</td>\n",
       "      <td>5</td>\n",
       "      <td>61</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85233</th>\n",
       "      <td>0.803527</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>58</td>\n",
       "      <td>263</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>146948</th>\n",
       "      <td>0.054416</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>39</td>\n",
       "      <td>448</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126425</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35</td>\n",
       "      <td>350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35573</th>\n",
       "      <td>0.539984</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>31</td>\n",
       "      <td>409</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27607</th>\n",
       "      <td>1.079607</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>46</td>\n",
       "      <td>246</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56979</th>\n",
       "      <td>0.781021</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>58</td>\n",
       "      <td>151</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49304</th>\n",
       "      <td>0.950342</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>43</td>\n",
       "      <td>280</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81058</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>44</td>\n",
       "      <td>274</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21708</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>502</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>106852</th>\n",
       "      <td>0.728366</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>44</td>\n",
       "      <td>364</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        RevolvingUtilizationOfUnsecuredLines  \\\n",
       "58539                               0.862907   \n",
       "74528                               1.000000   \n",
       "130362                              0.729272   \n",
       "105896                              0.527449   \n",
       "73233                               1.000000   \n",
       "83213                               0.976681   \n",
       "17958                               0.194393   \n",
       "41647                               1.031697   \n",
       "50991                               1.000000   \n",
       "17568                               0.747607   \n",
       "19179                               1.000000   \n",
       "147420                              1.093977   \n",
       "85568                               1.017013   \n",
       "77641                               0.974565   \n",
       "148684                              0.950171   \n",
       "90532                               0.398879   \n",
       "96038                               0.601903   \n",
       "60449                               1.000000   \n",
       "98361                               0.941550   \n",
       "768                                 0.000000   \n",
       "9712                                0.138934   \n",
       "67678                               0.000000   \n",
       "41673                               0.016081   \n",
       "109760                              1.000000   \n",
       "59063                               0.736396   \n",
       "126493                              0.379510   \n",
       "126335                              1.047904   \n",
       "21558                               1.000000   \n",
       "42445                               1.000000   \n",
       "423                                 0.991502   \n",
       "85233                               0.803527   \n",
       "146948                              0.054416   \n",
       "126425                              1.000000   \n",
       "35573                               0.539984   \n",
       "27607                               1.079607   \n",
       "56979                               0.781021   \n",
       "49304                               0.950342   \n",
       "81058                               1.000000   \n",
       "21708                               0.000000   \n",
       "106852                              0.728366   \n",
       "\n",
       "        NumberOfTime30-59DaysPastDueNotWorse  NumberOfTimes90DaysLate  \\\n",
       "58539                                      2                        3   \n",
       "74528                                      0                        0   \n",
       "130362                                     3                        1   \n",
       "105896                                     0                        0   \n",
       "73233                                      0                        1   \n",
       "83213                                      1                        0   \n",
       "17958                                      0                        0   \n",
       "41647                                      1                        0   \n",
       "50991                                      1                        2   \n",
       "17568                                      0                        2   \n",
       "19179                                     98                       98   \n",
       "147420                                     0                        0   \n",
       "85568                                      2                        4   \n",
       "77641                                      0                        0   \n",
       "148684                                     3                        0   \n",
       "90532                                      0                        3   \n",
       "96038                                      0                        1   \n",
       "60449                                      2                        0   \n",
       "98361                                      1                        0   \n",
       "768                                        0                        0   \n",
       "9712                                       1                        0   \n",
       "67678                                      4                        1   \n",
       "41673                                      0                        0   \n",
       "109760                                     0                        2   \n",
       "59063                                      0                        1   \n",
       "126493                                     2                        0   \n",
       "126335                                     2                        0   \n",
       "21558                                      0                        1   \n",
       "42445                                      0                        0   \n",
       "423                                       10                        2   \n",
       "85233                                      4                        1   \n",
       "146948                                     0                        0   \n",
       "126425                                     0                        0   \n",
       "35573                                      0                        0   \n",
       "27607                                      4                        1   \n",
       "56979                                      5                        0   \n",
       "49304                                      0                        4   \n",
       "81058                                      0                        8   \n",
       "21708                                      0                        0   \n",
       "106852                                     1                        0   \n",
       "\n",
       "        NumberOfTime60-89DaysPastDueNotWorse  age  score  \n",
       "58539                                      2   42    107  \n",
       "74528                                      0   23    344  \n",
       "130362                                     1   51    281  \n",
       "105896                                     0   37    409  \n",
       "73233                                      0   47    364  \n",
       "83213                                      1   35    350  \n",
       "17958                                      0   41    451  \n",
       "41647                                      0   39    350  \n",
       "50991                                      3   58    199  \n",
       "17568                                      0   47    300  \n",
       "19179                                     98   21     13  \n",
       "147420                                     0   29    350  \n",
       "85568                                      2   56    113  \n",
       "77641                                      0   57    381  \n",
       "148684                                     2   62    201  \n",
       "90532                                      0   46    350  \n",
       "96038                                      1   73    479  \n",
       "60449                                      0   38    272  \n",
       "98361                                      0   53    381  \n",
       "768                                        0   32    445  \n",
       "9712                                       0   52    468  \n",
       "67678                                      1   53    358  \n",
       "41673                                      3   59    358  \n",
       "109760                                     0   59    317  \n",
       "59063                                      0   39    350  \n",
       "126493                                     0   38    331  \n",
       "126335                                     0   61    329  \n",
       "21558                                      0   27    350  \n",
       "42445                                      0   28    350  \n",
       "423                                        5   61     67  \n",
       "85233                                      0   58    263  \n",
       "146948                                     0   39    448  \n",
       "126425                                     0   35    350  \n",
       "35573                                      0   31    409  \n",
       "27607                                      0   46    246  \n",
       "56979                                      2   58    151  \n",
       "49304                                      0   43    280  \n",
       "81058                                      0   44    274  \n",
       "21708                                      1   70    502  \n",
       "106852                                     0   44    364  "
      ]
     },
     "execution_count": 148,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#随机选择Good的5个人\n",
    "bad_sample = df_train[df_train['SeriousDlqin2yrs']==1].sample(40)\n",
    "bad_sample = bad_sample[feature_cols]\n",
    "#应用评分卡对sample计算分数\n",
    "calculate_score_with_card(bad_sample, score_card, A)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
